Jump to content

Mousehook mouse unhook problem


Recommended Posts

Im hooking the mouse clicks and mouse moves, works great! One problem though, it won't unregister mouse moves. here is the steps I take.

1. Register Mouse move

2. Register Mouse button clicks

3. Unhook Mouse using Unhook function

4. Register Mouse button clicks only

5. Mouse move is still registered.

Here is my source, here is my code.

If $IsGetMouseClick Or $IsGetMouseMove Then
        Global $mouseHOOKproc = DLLCall("kernel32.dll","hwnd","GetProcAddress","hwnd",$DLLInst[0],"str","MouseProc")
        Global $hhMouse = DLLCall("user32.dll","hwnd","SetWindowsHookEx","int",7, _
                "hwnd",$mouseHOOKproc[0],"hwnd",$DLLinst[0],"int",0)
        DLLCall(".\kh.dll","int","SetValuesMouse","hwnd",$gui,"hwnd",$hhMouse[0])
    EndIf
    If BitAND(GUICtrlRead($c_mouseclickrecord),$GUI_CHECKED) = 1 Then
        GUIRegisterMsg(0x1400 + 0x0A30,"_RecordMouseMacro") ;ldown clicks
        GUIRegisterMsg(0x1400 + 0x0A31,"_RecordMouseMacro") ;mouse
        GUIRegisterMsg(0x1400 + 0x0B30,"_RecordMouseMacro") ;mouse
        GUIRegisterMsg(0x1400 + 0x0B31,"_RecordMouseMacro") ;mouse
        GUIRegisterMsg(0x1400 + 0x0A32,"_RecordMouseMacro") ;mouse
        GUIRegisterMsg(0x1400 + 0x0B32,"_RecordMouseMacro") ;mouse ^^
        GUIRegisterMsg(0x1400 + 0x0C30,"_RecordMouseMacro") ;mouse double click
        GUIRegisterMsg(0x1400 + 0x0C31,"_RecordMouseMacro") ;mouse double click
    EndIf
    If BitAND(GUICtrlRead($c_mousepathrecord),$GUI_CHECKED) = 1 Then
        GUIRegisterMsg(0x1400 + 0x0F30,"_RecordMousePos") ;mouse move
    EndIf
oÝ÷ Øw«z+0êÞ"éá¢"´[aÇîËb¢v®¶­s`¤gVæ2õVäöö´¶W&ö&DÖ÷W6U&V6÷&B¢b4FV6Æ&VBgV÷C¶Ö÷W6RgV÷C²FVà DÄÄ6ÆÂgV÷C·W6W#3"æFÆÂgV÷C²ÂgV÷C¶çBgV÷C²ÂgV÷CµVæööµvæF÷w4öö´WgV÷C²ÂgV÷C¶væBgV÷C²Âb33c¶Ö÷W6U³Ò¢VæD`¢DÄÄ6ÆÂgV÷C·W6W#3"æFÆÂgV÷C²ÂgV÷C¶çBgV÷C²ÂgV÷CµVæööµvæF÷w4öö´WgV÷C²ÂgV÷C¶væBgV÷C²Âb33c¶¶W³Ò¢DÄÄ6ÆÂgV÷C¶¶W&æVÃ3"æFÆÂgV÷C²ÂgV÷C¶çBgV÷C²ÂgV÷C´g&VTÆ'&'gV÷C²ÂgV÷C¶væBgV÷C²Âb33c´DÄÆç7E³Ò¤VæDgVæ0

www.itoady.com

A* (A-star) Searching Algorithm - A.I. Artificial Intelligence bot path finding

Link to comment
Share on other sites

Also... you may not want to use the same $gui for hook messages as you use for user interface. A separate $gui is safer... just dont GUISetState() it.

Yes good idea, I noticed that as being a problem, it made my GUI inactive so I had to do something else.

I will do that then, thanks!

www.itoady.com

A* (A-star) Searching Algorithm - A.I. Artificial Intelligence bot path finding

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...