Jump to content



Photo

(callback) Low Level Mouse Hook


  • Please log in to reply
23 replies to this topic

#1 _Kurt

_Kurt

    I can only imagine the world without Autoit (see above)

  • Active Members
  • PipPipPipPipPipPip
  • 865 posts

Posted 02 October 2008 - 03:03 AM

Hi guys,

I'm not sure if someone else hasn't posted something like this, I didn't manage to find one through the search engine. I personally liked how it retrieves the mouse wheel state.
AutoIt         
; ~~ Mouse Hook ~~ ;For more info, Visit: http://msdn.microsoft.com/en-us/library/ms644986(VS.85).aspx ;Include GUI Consts #include <GUIConstants.au3> ;for $GUI_EVENT_CLOSE #Include <WinAPI.au3> ;for HIWORD ;These constants found in the helpfile under Windows Message Codes Global Const $WM_MOUSEMOVE = 0x0200 ;mouse move Global Const $WM_MOUSEWHEEL = 0x020A ;wheel up/down Global Const $WM_LBUTTONDBLCLK = 0x0203 ;left button Global Const $WM_LBUTTONDOWN = 0x0201 Global Const $WM_LBUTTONUP = 0x0202 Global Const $WM_RBUTTONDBLCLK = 0x0206 ;right button Global Const $WM_RBUTTONDOWN = 0x0204 Global Const $WM_RBUTTONUP = 0x0205 Global Const $WM_MBUTTONDBLCLK = 0x0209 ;wheel clicks Global Const $WM_MBUTTONDOWN = 0x0207 Global Const $WM_MBUTTONUP = 0x0208 ;Consts/structs from msdn Global Const $MSLLHOOKSTRUCT = $tagPOINT & ";dword mouseData;dword flags;dword time;ulong_ptr dwExtraInfo" ;~ Global Const $WH_MOUSE_LL = 14           ;already declared ;~ Global Const $tagPOINT = "int X;int Y"   ;already declared ;Create GUI $GUI = GUICreate("Mouse Hook", 178, 158, @DesktopWidth-178, 0) ;Top-Left corner $_Event = GUICtrlCreateLabel("Event: ", 8, 8, 158, 17) $_XYpos = GUICtrlCreateLabel("X=     Y=", 8, 32, 157, 17) $_MData = GUICtrlCreateLabel("Mouse Data: ", 8, 56, 165, 17) $_Flags = GUICtrlCreateLabel("Flags: ", 8, 80, 168, 17) $_Timestamp = GUICtrlCreateLabel("Timestamp: ", 8, 104, 162, 17) $_Extra = GUICtrlCreateLabel("Extra Info: ", 8, 128, 167, 17) GUISetState() WinSetOnTop($GUI, "", 1) ;make GUI stay on top of other windows ;Register callback $hKey_Proc = DllCallbackRegister("_Mouse_Proc", "int", "int;ptr;ptr") $hM_Module = DllCall("kernel32.dll", "hwnd", "GetModuleHandle", "ptr", 0) $hM_Hook = DllCall("user32.dll", "hwnd", "SetWindowsHookEx", "int", $WH_MOUSE_LL, "ptr", DllCallbackGetPtr($hKey_Proc), "hwnd", $hM_Module[0], "dword", 0) While 1     If $GUI_EVENT_CLOSE = GUIGetMsg() Then Exit ;idle until exit is pressed WEnd Func _Mouse_Proc($nCode, $wParam, $lParam) ;function called for mouse events..     ;define local vars     Local $info, $ptx, $pty, $mouseData, $flags, $time, $dwExtraInfo     Local $xevent = "Unknown", $xmouseData = ""         If $nCode < 0 Then ;recommended, see http://msdn.microsoft.com/en-us/library/ms644986(VS.85).aspx         $ret = DllCall("user32.dll", "long", "CallNextHookEx", "hwnd", $hM_Hook[0], _                 "int", $nCode, "ptr", $wParam, "ptr", $lParam) ;recommended         Return $ret[0]     EndIf         $info = DllStructCreate($MSLLHOOKSTRUCT, $lParam) ;used to get all data in the struct ($lParam is the ptr)     $ptx = DllStructGetData($info, 1) ;see notes below..     $pty = DllStructGetData($info, 2)     $mouseData = DllStructGetData($info, 3)     $flags = DllStructGetData($info, 4)     $time = DllStructGetData($info, 5)     $dwExtraInfo = DllStructGetData($info, 6)     ; $ptx = Mouse x position     ; $pty = Mouse y position     ; $mouseData = can specify click states, and wheel directions     ; $flags = Specifies the event-injected flag     ; $time = Specifies the time stamp for this message     ; $dwExtraInfo = Specifies extra information associated with the message.     ;Find which event happened     Select         Case $wParam = $WM_MOUSEMOVE             $xevent = "Mouse Move"         Case $wParam = $WM_MOUSEWHEEL             $xevent = "Mouse Wheel"             If _WinAPI_HiWord($mouseData) > 0 Then                 $xmouseData = "Wheel Forward"             Else                 $xmouseData = "Wheel Backward"             EndIf         Case $wParam = $WM_LBUTTONDBLCLK             $xevent = "Double Left Click"         Case $wParam = $WM_LBUTTONDOWN             $xevent = "Left Down"         Case $wParam = $WM_LBUTTONUP             $xevent = "Left Up"         Case $wParam = $WM_RBUTTONDBLCLK             $xevent = "Double Right Click"         Case $wParam = $WM_RBUTTONDOWN             $xevent = "Right Down"         Case $wParam = $WM_RBUTTONUP             $xevent = "Right Up"         Case $wParam = $WM_MBUTTONDBLCLK             $xevent = "Double Wheel Click"         Case $wParam = $WM_MBUTTONDOWN             $xevent = "Wheel Down"         Case $wParam = $WM_MBUTTONUP             $xevent = "Wheel Up"     EndSelect         ; Set GUI control data..     GUICtrlSetData($_Event, "Event: " & $xevent)     GUICtrlSetData($_XYpos, "X=" & $ptx & "     Y=" & $pty)     If $xmouseData <> "" Then         GUICtrlSetData($_MData, "Mouse Data: " & $xmouseData)     Else         GUICtrlSetData($_MData, "Mouse Data: " & $mouseData)     EndIf     GUICtrlSetData($_Flags, "Flags: " & $flags)     GUICtrlSetData($_Timestamp, "Timestamp: " & $time)     GUICtrlSetData($_Extra, "Extra Info: " & $dwExtraInfo)         ;This is recommended instead of Return 0     $ret = DllCall("user32.dll", "long", "CallNextHookEx", "hwnd", $hM_Hook[0], _             "int", $nCode, "ptr", $wParam, "ptr", $lParam)     Return $ret[0] EndFunc   ;==>_Mouse_Proc Func OnAutoItExit()     DllCall("user32.dll", "int", "UnhookWindowsHookEx", "hwnd", $hM_Hook[0])     $hM_Hook[0] = 0     DllCallbackFree($hKey_Proc)     $hKey_Proc = 0 EndFunc   ;==>OnAutoItExit


Resource: http://msdn.microsoft.com/en-us/library/ms644986(VS.85).aspx

Kurt
Awaiting Diablo III..





#2 ptrex

ptrex

    Universalist

  • MVPs
  • 2,399 posts

Posted 02 October 2008 - 08:33 AM

@_Kurt

Very nice !!

No comments because it works like it should.

Thanks

Regards,

ptrex

#3 _Kurt

_Kurt

    I can only imagine the world without Autoit (see above)

  • Active Members
  • PipPipPipPipPipPip
  • 865 posts

Posted 02 October 2008 - 02:03 PM

Thanks, and sorry about the limited amount of comments.

I still am not really sure how $dwExtraInfo can be used, there is no useful comments from msdn.

Also, I've noticed that I don't ever receive the $WM_LBUTTONDBLCLK / $WM_RBUTTONDBLCLK / $WM_MBUTTONDBLCLK events.

Kurt
Awaiting Diablo III..

#4 ProgAndy

ProgAndy

    You need AutoItObject

  • MVPs
  • 2,508 posts

Posted 02 October 2008 - 02:12 PM

I think _MouseSetOnEvent UDF uses this callback.
*GERMAN* Posted Image [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

#5 Toady

Toady

    Easy there turbo...

  • Active Members
  • PipPipPipPipPipPip
  • 698 posts

Posted 02 October 2008 - 03:18 PM

Nice work Kurt,

Excellent example of a mouse hook.
www.itoady.com (Go here to download the MacroGamer installer)

#6 WeMartiansAreFriendly

WeMartiansAreFriendly

    Where's the kaboom?

  • Active Members
  • PipPipPipPipPipPip
  • 1,245 posts

Posted 30 October 2008 - 04:26 AM

I've been using hook.dll by larry for watching the mouse. That's great that this can be accomplished with just AutoIt.
Posted ImageDon't bother, It's inside your monitor!------GUISetOnEvent should behave more like HotKeySet()

#7 sandin

sandin

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 569 posts

Posted 31 October 2008 - 11:51 PM

here's some contribution from my side for x-button on your mouse:
add this in the top of the script:
AutoIt         
Global Const $WM_XBUTTONDOWN = 0x020B ;x-button down Global Const $WM_XBUTTONUP = 0x020Cƒo݊÷ Ù©Ý­êeinj¢ë¦º~éÜÂ+a¶¬jëhŠ×6Func _Mouse_Proc($nCode, $wParam, $lParam) ;function called for mouse events..     ;define local vars     Local $info, $ptx, $pty, $mouseData, $flags, $time, $dwExtraInfo     Local $xevent = "Unknown", $xmouseData = ""         If $nCode < 0 Then ;recommended, see <a href='http://msdn.microsoft.com/en-us/library/ms644986(VS.85' class='bbc_url' title='External link' rel='nofollow external'>http://msdn.microsoft.com/en-us/library/ms644986(VS.85</a>).aspx         $ret = DllCall("user32.dll", "long", "CallNextHookEx", "hwnd", $hM_Hook[0], _                 "int", $nCode, "ptr", $wParam, "ptr", $lParam) ;recommended         Return $ret[0]     EndIf         $info = DllStructCreate($MSLLHOOKSTRUCT, $lParam) ;used to get all data in the struct ($lParam is the ptr)     $ptx = DllStructGetData($info, 1) ;see notes below..     $pty = DllStructGetData($info, 2)     $mouseData = DllStructGetData($info, 3)     $flags = DllStructGetData($info, 4)     $time = DllStructGetData($info, 5)     $dwExtraInfo = DllStructGetData($info, 6)     ; $ptx = Mouse x position     ; $pty = Mouse y position     ; $mouseData = can specify click states, and wheel directions     ; $flags = Specifies the event-injected flag     ; $time = Specifies the time stamp for this message     ; $dwExtraInfo = Specifies extra information associated with the message.     ;Find which event happened     Select         Case $wParam = $WM_MOUSEMOVE             $xevent = "Mouse Move"         Case $wParam = $WM_MOUSEWHEEL             $xevent = "Mouse Wheel"             If _WinAPI_HiWord($mouseData) > 0 Then                 $xmouseData = "Wheel Forward"             Else                 $xmouseData = "Wheel Backward"             EndIf         case $wParam = $WM_XBUTTONDOWN             $xevent = "x-button down"             If _WinAPI_HiWord($mouseData) = 1 Then                 $xmouseData = "Forward"             Else                 $xmouseData = "Backward"             EndIf         case $wParam = $WM_XBUTTONUP             $xevent = "x-button up"             If _WinAPI_HiWord($mouseData) = 1 Then                 $xmouseData = "Forward"             Else                 $xmouseData = "Backward"             EndIf         Case $wParam = $WM_LBUTTONDBLCLK             $xevent = "Double Left Click"         Case $wParam = $WM_LBUTTONDOWN             $xevent = "Left Down"         Case $wParam = $WM_LBUTTONUP             $xevent = "Left Up"         Case $wParam = $WM_RBUTTONDBLCLK             $xevent = "Double Right Click"         Case $wParam = $WM_RBUTTONDOWN             $xevent = "Right Down"         Case $wParam = $WM_RBUTTONUP             $xevent = "Right Up"         Case $wParam = $WM_MBUTTONDBLCLK             $xevent = "Double Wheel Click"         Case $wParam = $WM_MBUTTONDOWN             $xevent = "Wheel Down"         Case $wParam = $WM_MBUTTONUP             $xevent = "Wheel Up"     EndSelect         ; Set GUI control data..     GUICtrlSetData($_Event, "Event: " & $xevent)     GUICtrlSetData($_XYpos, "X=" & $ptx & "     Y=" & $pty)     If $xmouseData <> "" Then         GUICtrlSetData($_MData, "Mouse Data: " & $xmouseData)     Else         GUICtrlSetData($_MData, "Mouse Data: " & $mouseData)     EndIf     GUICtrlSetData($_Flags, "Flags: " & $flags)     GUICtrlSetData($_Timestamp, "Timestamp: " & $time)     GUICtrlSetData($_Extra, "Extra Info: " & $dwExtraInfo)         ;This is recommended instead of Return 0     $ret = DllCall("user32.dll", "long", "CallNextHookEx", "hwnd", $hM_Hook[0], _             "int", $nCode, "ptr", $wParam, "ptr", $lParam)     Return $ret[0] EndFunc   ;==>_Mouse_Proc

Edited by sandin, 01 November 2008 - 12:07 AM.


#8 Josbe

Josbe

    Infrequent ghost ☺

  • Active Members
  • PipPipPipPipPipPip
  • 1,585 posts

Posted 01 November 2008 - 02:08 AM

I hadn't noticed this thread...Thanks, _Kurt.

#9 Madza91

Madza91

    Madža91

  • Active Members
  • PipPipPipPipPipPip
  • 531 posts

Posted 26 January 2009 - 11:01 AM

Hi, this is very good, BUT there is some error... On exiting script, when I push X button - Exit, script and mouse is blocked on half of second...


Why?

This is a help forum not a "write this for me" forum.

(Sorry for bad English) :)

#10 Manadar

Manadar

    Taking a REST.

  • MVPs
  • 10,714 posts

Posted 26 January 2009 - 01:16 PM

Hi, this is very good, BUT there is some error... On exiting script, when I push X button - Exit, script and mouse is blocked on half of second...


Why?

Because pressing the X button, or dragging the window, will freeze the script that is running it. It's windows behavior.

#11 Madza91

Madza91

    Madža91

  • Active Members
  • PipPipPipPipPipPip
  • 531 posts

Posted 26 January 2009 - 09:59 PM

Aha, and is there a way to been fixed?

(I know for hook.dll, but I want to know is it possible to do it without any external dll's...)

Edited by n3nE, 26 January 2009 - 10:01 PM.

This is a help forum not a "write this for me" forum.

(Sorry for bad English) :)

#12 Digisoul

Digisoul

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 312 posts

Posted 27 January 2009 - 11:13 AM

Hi guys,

I'm not sure if someone else hasn't posted something like this, I didn't manage to find one through the search engine. I personally liked how it retrieves the mouse wheel state.

AutoIt         
; ~~ Mouse Hook ~~ ;For more info, Visit: http://msdn.microsoft.com/en-us/library/ms644986(VS.85).aspx ;Include GUI Consts #include <GUIConstants.au3> ;for $GUI_EVENT_CLOSE #Include <WinAPI.au3> ;for HIWORD ;These constants found in the helpfile under Windows Message Codes Global Const $WM_MOUSEMOVE = 0x0200 ;mouse move Global Const $WM_MOUSEWHEEL = 0x020A ;wheel up/down Global Const $WM_LBUTTONDBLCLK = 0x0203 ;left button Global Const $WM_LBUTTONDOWN = 0x0201 Global Const $WM_LBUTTONUP = 0x0202 Global Const $WM_RBUTTONDBLCLK = 0x0206 ;right button Global Const $WM_RBUTTONDOWN = 0x0204 Global Const $WM_RBUTTONUP = 0x0205 Global Const $WM_MBUTTONDBLCLK = 0x0209 ;wheel clicks Global Const $WM_MBUTTONDOWN = 0x0207 Global Const $WM_MBUTTONUP = 0x0208 ;Consts/structs from msdn Global Const $MSLLHOOKSTRUCT = $tagPOINT & ";dword mouseData;dword flags;dword time;ulong_ptr dwExtraInfo" ;~ Global Const $WH_MOUSE_LL = 14           ;already declared ;~ Global Const $tagPOINT = "int X;int Y"   ;already declared ;Create GUI $GUI = GUICreate("Mouse Hook", 178, 158, @DesktopWidth-178, 0) ;Top-Left corner $_Event = GUICtrlCreateLabel("Event: ", 8, 8, 158, 17) $_XYpos = GUICtrlCreateLabel("X=     Y=", 8, 32, 157, 17) $_MData = GUICtrlCreateLabel("Mouse Data: ", 8, 56, 165, 17) $_Flags = GUICtrlCreateLabel("Flags: ", 8, 80, 168, 17) $_Timestamp = GUICtrlCreateLabel("Timestamp: ", 8, 104, 162, 17) $_Extra = GUICtrlCreateLabel("Extra Info: ", 8, 128, 167, 17) GUISetState() WinSetOnTop($GUI, "", 1) ;make GUI stay on top of other windows ;Register callback $hKey_Proc = DllCallbackRegister("_Mouse_Proc", "int", "int;ptr;ptr") $hM_Module = DllCall("kernel32.dll", "hwnd", "GetModuleHandle", "ptr", 0) $hM_Hook = DllCall("user32.dll", "hwnd", "SetWindowsHookEx", "int", $WH_MOUSE_LL, "ptr", DllCallbackGetPtr($hKey_Proc), "hwnd", $hM_Module[0], "dword", 0) While 1     If $GUI_EVENT_CLOSE = GUIGetMsg() Then Exit ;idle until exit is pressed WEnd Func _Mouse_Proc($nCode, $wParam, $lParam) ;function called for mouse events..     ;define local vars     Local $info, $ptx, $pty, $mouseData, $flags, $time, $dwExtraInfo     Local $xevent = "Unknown", $xmouseData = ""         If $nCode < 0 Then ;recommended, see http://msdn.microsoft.com/en-us/library/ms644986(VS.85).aspx         $ret = DllCall("user32.dll", "long", "CallNextHookEx", "hwnd", $hM_Hook[0], _                 "int", $nCode, "ptr", $wParam, "ptr", $lParam) ;recommended         Return $ret[0]     EndIf         $info = DllStructCreate($MSLLHOOKSTRUCT, $lParam) ;used to get all data in the struct ($lParam is the ptr)     $ptx = DllStructGetData($info, 1) ;see notes below..     $pty = DllStructGetData($info, 2)     $mouseData = DllStructGetData($info, 3)     $flags = DllStructGetData($info, 4)     $time = DllStructGetData($info, 5)     $dwExtraInfo = DllStructGetData($info, 6)     ; $ptx = Mouse x position     ; $pty = Mouse y position     ; $mouseData = can specify click states, and wheel directions     ; $flags = Specifies the event-injected flag     ; $time = Specifies the time stamp for this message     ; $dwExtraInfo = Specifies extra information associated with the message.     ;Find which event happened     Select         Case $wParam = $WM_MOUSEMOVE             $xevent = "Mouse Move"         Case $wParam = $WM_MOUSEWHEEL             $xevent = "Mouse Wheel"             If _WinAPI_HiWord($mouseData) > 0 Then                 $xmouseData = "Wheel Forward"             Else                 $xmouseData = "Wheel Backward"             EndIf         Case $wParam = $WM_LBUTTONDBLCLK             $xevent = "Double Left Click"         Case $wParam = $WM_LBUTTONDOWN             $xevent = "Left Down"         Case $wParam = $WM_LBUTTONUP             $xevent = "Left Up"         Case $wParam = $WM_RBUTTONDBLCLK             $xevent = "Double Right Click"         Case $wParam = $WM_RBUTTONDOWN             $xevent = "Right Down"         Case $wParam = $WM_RBUTTONUP             $xevent = "Right Up"         Case $wParam = $WM_MBUTTONDBLCLK             $xevent = "Double Wheel Click"         Case $wParam = $WM_MBUTTONDOWN             $xevent = "Wheel Down"         Case $wParam = $WM_MBUTTONUP             $xevent = "Wheel Up"     EndSelect         ; Set GUI control data..     GUICtrlSetData($_Event, "Event: " & $xevent)     GUICtrlSetData($_XYpos, "X=" & $ptx & "     Y=" & $pty)     If $xmouseData <> "" Then         GUICtrlSetData($_MData, "Mouse Data: " & $xmouseData)     Else         GUICtrlSetData($_MData, "Mouse Data: " & $mouseData)     EndIf     GUICtrlSetData($_Flags, "Flags: " & $flags)     GUICtrlSetData($_Timestamp, "Timestamp: " & $time)     GUICtrlSetData($_Extra, "Extra Info: " & $dwExtraInfo)         ;This is recommended instead of Return 0     $ret = DllCall("user32.dll", "long", "CallNextHookEx", "hwnd", $hM_Hook[0], _             "int", $nCode, "ptr", $wParam, "ptr", $lParam)     Return $ret[0] EndFunc   ;==>_Mouse_Proc Func OnAutoItExit()     DllCall("user32.dll", "int", "UnhookWindowsHookEx", "hwnd", $hM_Hook[0])     $hM_Hook[0] = 0     DllCallbackFree($hKey_Proc)     $hKey_Proc = 0 EndFunc   ;==>OnAutoItExit

Resource: http://msdn.microsoft.com/en-us/library/ms644986(VS.85).aspx

Kurt

Your script is very good but when i run this script, this will slow the speed of pointer ?
73 108 111 118 101 65 117 116 111 105 116 Posted Image

#13 Manadar

Manadar

    Taking a REST.

  • MVPs
  • 10,714 posts

Posted 27 January 2009 - 03:13 PM

Aha, and is there a way to been fixed?

(I know for hook.dll, but I want to know is it possible to do it without any external dll's...)

You don't "fix" Windows behavior. You can only work around it.

Just don't use a GUI and your problem is solved.

#14 Madza91

Madza91

    Madža91

  • Active Members
  • PipPipPipPipPipPip
  • 531 posts

Posted 27 January 2009 - 03:16 PM

LOL!

I need GUI...

This is a help forum not a "write this for me" forum.

(Sorry for bad English) :)

#15 Manadar

Manadar

    Taking a REST.

  • MVPs
  • 10,714 posts

Posted 27 January 2009 - 03:18 PM

Give a bit of background on what you're trying to do.

Edit: I think it might be more appropriate if you make a new help thread.

Edited by Manadar, 27 January 2009 - 03:18 PM.


#16 Madza91

Madza91

    Madža91

  • Active Members
  • PipPipPipPipPipPip
  • 531 posts

Posted 27 January 2009 - 03:53 PM

I already make it: please look

This is a help forum not a "write this for me" forum.

(Sorry for bad English) :)

#17 UEZ

UEZ

    Never say never

  • MVPs
  • 3,600 posts

Posted 12 April 2009 - 03:55 PM

What is the parameter for $wParam when e.g. hold down lmb and moving mouse around?

Mouse move is 0x200 and lmb down is 0x201...

Thanks,

UEZ

 
The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯


#18 Authenticity

Authenticity

    Universalist

  • MVPs
  • 2,619 posts

Posted 12 April 2009 - 05:57 PM

The value is of $WM_MOUSEMOVE. You can use a flag variable when WM_LBUTTONDOWN for example and do something like:
If $iwParam = $WM_MOUSEMOVE Then     If $fPressed Then         ; Something when pressed.     Else         ; Something when not pressed.     EndIf EndIf


#19 Spiff59

Spiff59

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 1,312 posts

Posted 19 April 2009 - 06:17 AM

I was messing with the WM_SETCURSOR message, it also reports mouse events.
[codebox]
Plain Text         
#include <WindowsConstants.au3> ;Global Const $WM_MOUSEMOVE = 0x200 Global Const $WM_LBUTTONDOWN = 0x201 ;Global Const $WM_LBUTTONUP = 0x202 Global Const $WM_RBUTTONDOWN = 0x204 Global Const $WM_RBUTTONUP = 0x205 Global Const $WM_MBUTTONDOWN = 0x207 Global Const $WM_MBUTTONUP = 0x208 Global $cursor = 0 $Gui = GuiCreate("Test", 300, 200) GUISetState(@SW_SHOW) Sleep(2000) GUIRegisterMsg($WM_SETCURSOR, 'WM_SETCURSOR') $OldCur = DllCall("user32.dll", "int", "GetCursor") $Cur = DllCall("user32.dll", "int", "LoadCursorFromFile", "str","C:\windows\cursors\hmove.cur") While 1     $Msg = GUIGetMsg()     Sleep(10)     If $Msg = -3 Then Exit; $GUI_EVENT_CLOSE WEnd Func WM_SETCURSOR($hWnd, $iMsg, $iWParam, $iLParam)     $iLParamhigh = BitShift($iLParam, 16);HiWord     $iLParamlow  = BitAnd($iLParam, 0x0000FFFF);LoWord     If $hWnd = $Gui Then         If $iLParamlow = 1 Then             tooltip("0x" & hex($iLParamhigh, 4))             If $cursor = 0 Then                 beep(800,10)                 $cursor = 1                 DllCall("user32.dll", "int", "SetCursor", "int", $Cur[0])             EndIf         Else             $cursor = 0             DllCall("user32.dll", "int", "SetCursor", "int", $OldCur[0])         EndIf     Else         $cursor = 0         tooltip("")     EndIf     Return 0 EndFunc

I'm just curious, how did these:

Global Const $WM_MOUSEMOVE = 0x200
Global Const $WM_LBUTTONUP = 0x202

find their way into WindowsConstants.au3, but not these:

Global Const $WM_LBUTTONDOWN = 0x201
Global Const $WM_RBUTTONDOWN = 0x204
Global Const $WM_RBUTTONUP = 0x205
Global Const $WM_MBUTTONDOWN = 0x207
Global Const $WM_MBUTTONUP = 0x208

???

#20 rover

rover

    unmutual

  • Active Members
  • PipPipPipPipPipPip
  • 825 posts

Posted 19 April 2009 - 07:48 AM

I'm just curious, how did these:

Global Const $WM_MOUSEMOVE = 0x200
Global Const $WM_LBUTTONUP = 0x202

find their way into WindowsConstants.au3, but not these:

Global Const $WM_LBUTTONDOWN = 0x201
Global Const $WM_RBUTTONDOWN = 0x204
Global Const $WM_RBUTTONUP = 0x205
Global Const $WM_MBUTTONDOWN = 0x207
Global Const $WM_MBUTTONUP = 0x208

???

I've noticed that one before
submit it to Trac
I see fascists...




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users