Declare Function SetWindowsHookEx Lib "user32" Alias "SetWindowsHookExA" (ByVal idHook As Long, ByVal lpfn As Long, ByVal hmod As Long, ByVal dwThreadId As Long) As Long
Declare Function CallNextHookEx Lib "user32" (ByVal hHook As Long, ByVal nCode As Long, ByVal wParam As Long, lParam As Any) As Long
Declare Function UnhookWindowsHookEx Lib "user32" (ByVal hHook As Long) As Long
Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (lpvDest As Any, ByVal lpvSource As Long, ByVal cbCopy As Long)
Declare Function ScreenToClient Lib "user32" (ByVal hwnd As Long, lpPoint As POINTAPI) As Long
Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd As Long, lpdwProcessId As Long) As Long
Private mhHook As Long
Private mctlRect As RECT
Public gfrmMouseMove As Form
Public gctlMouseMove As Control
Function g_MouseMoveEvent(ctl As Control, frm As Form) As Boolean
试试
Public Declare Function GetWindowLong Lib "user32" Alias _
"GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) _
As Long
Public Const GWL_HINSTANCE = (-6)
hmod=GetWindowLong(Forms!窗体A.hwnd, (-6))作者: andymark 时间: 2009-4-11 16:05
试试下面的代码
Dim hInst As Long
Dim Thread As Long
hInst = GetModuleHandle(vbNullString)
Thread = GetCurrentThreadId()