Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problem Implementing mouse hook
#2
thanks to:
I want to use mouse event..

Code to disable both keyboard and mouse temporarily


I am using this code that i take from your hook posts.


function:
WE_CreatedWindowInstall
Code:
Copy      Help
function [off]

dll user32 #SetWindowsHookEx idHook lpfn hmod dwThreadId
dll user32 #UnhookWindowsHookEx hHook
dll user32 #CallNextHookEx hHook ncode wParam !*lParam
def WH_MOUSE_LL 14
;Installs/uninstalls hooks that will call WE_CreatedWindowProc whenever an object is created.
;This function does not need to be modified.

int+ hook
if(off) if(hook) UnhookWindowsHookEx(hook); hook=0
else
    if(getopt(nthreads)>1) mes "Already running. If in QM, use Threads dialog to end thread. If in exe, thread will end automatically." "" "i"; ret
    hook=SetWindowsHookEx(WH_MOUSE_LL &WE_CreatedWindowProc _hinst 0)
    atend WE_CreatedWindowInstall 1
    opt waitmsg 1
    wait -1


function:

WE_CreatedWindowProc
Code:
Copy      Help
;/WE_Main
function nCode wParam MSLLHOOKSTRUCT*lParam

out lParam.pt.x




ret CallNextHookEx(hook nCode wParam lParam)

out lParam.pt.x will return the x mouse cordinates and wParam the action.
thanks for your previous posts.


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)