Imports System.Runtime.InteropServices
Public Class frmAcceso
#Region "Mov. Pantalla"
    <DllImport("user32.Dll", EntryPoint:="ReleaseCapture")>
    Private Shared Sub ReleaseCapture()

    End Sub

    <DllImport("user32.Dll", EntryPoint:="SendMessage")>
    Private Shared Sub SendMessage(hWnd As IntPtr, wMsg As Integer, wParam As Integer, lParam As Integer)

    End Sub

#End Region

    Private Sub Label1_MouseMove(sender As Object, e As MouseEventArgs) Handles Label1.MouseMove
        ReleaseCapture()
        SendMessage(Me.Handle, &H112&, &HF012&, 0)
    End Sub

    Private Sub Panel2_MouseMove(sender As Object, e As MouseEventArgs) Handles Panel2.MouseMove
        ReleaseCapture()
        SendMessage(Me.Handle, &H112&, &HF012&, 0)
    End Sub
    Private Sub btnLogin_Click(sender As Object, e As EventArgs) Handles btnLogin.Click
        RevisarAcceso()
    End Sub

    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        GlobalVariables.VarClaveOK = False
        GlobalVariables.VarOpcion = ""
        Me.Close()
    End Sub

    Private Sub frmAcceso_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Me.txtPassword.Text = ""
        txtPassword.Focus()
    End Sub

    Private Sub txtPassword_Click(sender As Object, e As EventArgs) Handles txtPassword.Click
        txtPassword.Text = ""
        txtPassword.Focus()
    End Sub

    Private Sub txtPassword_KeyDown(sender As Object, e As KeyEventArgs) Handles txtPassword.KeyDown
        If e.KeyCode = Keys.Enter Then
            RevisarAcceso()
        End If
    End Sub

    Sub RevisarAcceso()
        GlobalVariables.VarClaveOK = ObtenerClave(GlobalVariables.VarOpcion, Me.txtPassword.Text)
        GlobalVariables.varUsuarioAcceso = DLookup("Usuario", "Claves", "Clave='" & txtPassword.Text & "' and Opcion='" & GlobalVariables.VarOpcion & "'")

        GlobalVariables.VarOpcion = ""
        Me.Close()
    End Sub


End Class