GFKeyHook/Testfrm.frm

VERSION 5.00
Begin VB.Form Testfrm
   Caption         =   "Form1"
   ClientHeight    =   3195
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   4695
   LinkTopic       =   "Form1"
   ScaleHeight     =   3195
   ScaleWidth      =   4695
   StartUpPosition =   3 'Windows‑Standard
   Begin VB.TextBox Text1
      Height          =   255
      Left            =   1080
      TabIndex        =   0
      Text            =   "THIS GONNE BE ELRIGHT"
      Top             =   1680
      Width           =   2535
   End
End
Attribute VB_Name = "Testfrm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
'(c)2001, 2004 by Louis. Test for for GFKeyHookmod.
'
'NOTE: the GFKeyHookmod should be used to create application‑wide
'"hot keys", i.e. keys that lead instantly to a larger program action.
'The GFKeyHookmod provides the hook only, displaying which key
'leads to which action and checking key hook messages for hot
'keys must be done by the target project.
'
'Downloaded from www.louis‑coder.com.
'Use to process hot keys for your application. Can NOT be used to set
'up a global key hook (for global hot keys, keyloggers, etc.), therefore you
'need to place the call to SetWindowsHookEx() function within a VC++ dll.

Private Sub Form_Load()
    'on error resume next
    Call GFKeyHook_SetKeyHook("Testfrm", Testfrm)
End Sub

Public Sub GFKeyHookProc(ByVal SourceDescription As StringByVal KeyCode As IntegerByVal Shift As IntegerByRef ReturnValueUsedFlag As BooleanByRef ReturnValue As Long)
    'on error resume next
    Debug.Print SourceDescription
    Debug.Print KeyCode
    Debug.Print Shift
    If (KeyCode = 65) Then
        ReturnValueUsedFlag = True
        ReturnValue = 1 'A/a is disabled
    End If
End Sub

Private Sub Form_Unload(Cancel As Integer)
    'on error resume next
    Call GFKeyHook_Terminate 'important, call when your project is exitted
End Sub


[END OF FILE]