Aparentemente este codigo es la solucion para deshabilitar la tecla de
Windows, Alt+tab, Alt+Esc, Ctrl+Esc, W+L,W+R,W+F,..etc., pero esta en
visual basic, talvez alguien del foro lo puede trasladar a vfp9
Private Declare Function MessageBeep Lib "user32" (ByVal wType As Long) As
Long
Private Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long)
As Integer
Private WithEvents apiLink As EventVB.APIFunctions
Private WithEvents hook As EventVB.ApiSystemHook
Private Const vbKeyLWin As Integer = 91
Private Const vbKeyRWin As Integer = 92
Private Const vbKeyLCtrl As Integer = 162
Private Const vbKeyRCtrl As Integer = 163
Private Sub Form_Load()
Set apiLink = New EventVB.APIFunctions
Set hook = apiLink.System.Hooks
hook.StartHook WH_KEYBOARD_LL, HOOK_GLOBAL
End Sub
Private Sub Form_Unload(Cancel As Integer)
hook.StopHook WH_KEYBOARD_LL
Set hook = Nothing
Set apiLink = Nothing
End Sub
Private Sub hook_KeyDown(ByVal VKey As Long, ByVal scanCode _
As Long, ByVal ExtendedKey As Boolean, ByVal AltDown As _
Boolean, ByVal Injected As Boolean, Cancel As Boolean)
'Alt Tab
If AltDown And VKey = vbKeyTab Then
Cancel = True
'Alt Esc
ElseIf AltDown And VKey = vbKeyEscape Then
Cancel = True
'Ctrl Esc
ElseIf VKey = vbKeyEscape Then
'Check if a ctrl key down
If GetKeyState(vbKeyLCtrl) And &HF0000000 Or _
GetKeyState(vbKeyRCtrl) And &HF0000000 Then
Cancel = True
End If
'Windows key (L/R). Used to "disable" the start menu.
'Stops single keydown of a windows key
ElseIf VKey = vbKeyLWin Or VKey = vbKeyRWin Then
Cancel = True
'Windows + Any
'If there is a hotkey combination being pressed,
'the Windows key will not be stored in VKey,
'So I check the state of the windows keys.
'If they are down, cancel keys
Else
If GetKeyState(vbKeyLWin) And &HF0000000 Or _
GetKeyState(vbKeyRWin) And &HF0000000 Then
Cancel = True
End If
End If
'This is totally optional of course
If Cancel = True Then 'We have stopped some keystrokes. Beep
MessageBeep 0
End If
End Sub
-
PortalFox :: Nada corre como un zorr
http://www.portalfox.co
PortalFox - NNTP Forum Gatewa
Leer las respuestas