moto25ru
Newbie | Редактировать | Профиль | Сообщение | ICQ | Цитировать | Сообщить модератору #cs ---------------------------------------------------------------------------- http://msdn.microsoft.com/en-us/library/ms644990(VS.85).aspx HHOOK SetWindowsHookEx( int idHook, [in] Specifies the type of hook procedure to be installed HOOKPROC lpfn, [in] Pointer to the hook procedure HINSTANCE hMod, [in] Handle to the DLL containing the hook procedure pointed to by the lpfn parameter DWORD dwThreadId [in] Specifies the identifier of the thread with which the hook procedure is to be associated ); http://msdn.microsoft.com/en-us/library/ms644986(VS.85).aspx LRESULT CALLBACK LowLevelMouseProc( int nCode, [in] Specifies a code the hook procedure uses to determine how to process the message. WPARAM wParam, [in] Specifies the identifier of the mouse message LPARAM lParam [in] Pointer to an MSLLHOOKSTRUCT structure ); http://msdn.microsoft.com/en-us/library/ms644988(VS.85).aspx LRESULT CALLBACK MouseProc( int nCode, [in] Specifies a code the hook procedure uses to determine how to process the message WPARAM wParam, [in] Specifies the identifier of the mouse message. LPARAM lParam [in] Pointer to a MOUSEHOOKSTRUCT structure. ); http://msdn.microsoft.com/en-us/library/ms644968(VS.85).aspx typedef struct { POINT pt; Specifies a POINT structure that contains the x- and y-coordinates of the cursor, in screen coordinates. HWND hwnd; Handle to the window that will receive the mouse message corresponding to the mouse event. UINT wHitTestCode; Specifies the hit-test value. For a list of hit-test values, see the description of the WM_NCHITTEST message. ULONG_PTR dwExtraInfo; Specifies extra information associated with the message. } MOUSEHOOKSTRUCT, *PMOUSEHOOKSTRUCT; http://msdn.microsoft.com/en-us/library/dd162805(VS.85).aspx typedef struct tagPOINT { LONG x; LONG y; } POINT, *PPOINT; http://msdn.microsoft.com/en-us/library/ms645618(VS.85).aspx WM_NCHITTEST WPARAM wParam LPARAM lParam; http://msdn.microsoft.com/en-us/library/ms644968(VS.85).aspx typedef struct { POINT pt; HWND hwnd; UINT wHitTestCode; ULONG_PTR dwExtraInfo; } MOUSEHOOKSTRUCT, *PMOUSEHOOKSTRUCT; #ce ---------------------------------------------------------------------------- #Include <Array.au3> HotKeySet("{ESC}", "OnAutoItExit") Global Const $WH_MOUSE_LL = 14 Global $hMod = DllCall("kernel32.dll", "hwnd", "GetModuleHandle", "ptr", 0) Global $hStub_mouseProc = DllCallbackRegister("_mouseProc", "int", "int;ptr;ptr") Global $hHook = DllCall("user32.dll", "hwnd", "SetWindowsHookEx", "int", _ $WH_MOUSE_LL, "ptr", DllCallbackGetPtr($hStub_mouseProc), "hwnd", $hMod[0], "dword", 0) While 1 Sleep(10) WEnd Func _mouseProc($nCode, $wParam, $lParam) Local $aRet, $MOUSEHOOKSTRUCT Local $x, $y If $nCode < 0 Then $aRet = DllCall("user32.dll", "long", "CallNextHookEx", "hwnd", $hHook[0], "int", $nCode, "ptr", $wParam, "ptr", $lParam) Return $aRet[0] EndIf If $wParam = 512 Then $MOUSEHOOKSTRUCT = DllStructCreate("int[2];hwnd;UINT;ptr", $lParam) $x=DllStructGetData($MOUSEHOOKSTRUCT, 1, 1) $y=DllStructGetData($MOUSEHOOKSTRUCT, 1, 2) ToolTip ("x="&$x&" | y="&$y) EndIf $aRet = DllCall("user32.dll", "long", "CallNextHookEx", "hwnd", $hHook[0], "int", $nCode, "ptr", $wParam, "ptr", $lParam) Return $aRet[0] EndFunc Func OnAutoItExit() If $hStub_mouseProc Then DllCallbackFree($hStub_mouseProc) $hStub_mouseProc = 0 DllCall("user32.dll", "int", "UnhookWindowsHookEx", "hwnd", $hHook[0]) If @HotKeyPressed <> "" Then Exit EndFunc | Всего записей: 12 | Зарегистр. 02-06-2009 | Отправлено: 14:29 22-06-2009 | Исправлено: moto25ru, 14:37 22-06-2009 |
|