how to write mouse hook procedure with all application !!

Just starting out? Need help? Post your questions and find answers here.
Nueng
User
User
Posts: 35
Joined: Fri May 27, 2005 11:16 am

how to write mouse hook procedure with all application !!

Post by Nueng »

I see this code

Code: Select all

#WM_CAPTURECHANGED=533 

Procedure WndProc(hhWnd, uMsg, wParam, lParam) 
Select uMsg 
    Case #WM_CAPTURECHANGED 
       Debug lParam 
       Debug "Mouse Capturechanged" 
       ProcedureReturn 0 
    Case #WM_LBUTTONDOWN
        MessageRequester("Left","ok")
        ProcedureReturn 0
    Case #WM_RBUTTONDOWN
        MessageRequester("Rightt","ok")
        ProcedureReturn 0
EndSelect 
ProcedureReturn DefWindowProc_(hhWnd,uMsg,wParam,lParam) 
EndProcedure 

hwnd = OpenWindow(1,10,10,300,300,#PB_Window_SystemMenu,"") 
SetCapture_(hwnd) 
SetWindowCallback(@WndProc()) 

Repeat 
   Select WaitWindowEvent() 
      Case #WM_LBUTTONDOWN  : A$ = "Left Mouse Button pressed" 
      Case #WM_LBUTTONUP    : A$ = "Left Mouse Button released" 
      Case #WM_MOUSEMOVE    : A$ = "Mouse has moved"      
      Case #PB_EventCloseWindow: End 
   EndSelect 
   SetWindowText_(hwnd, A$): 
ForEver 
but It's work in own application not for all application

can you introduce me to fix this problem...

thank you..
\\ (^O^) //

Thank god for send you to Help me..
lexvictory
Addict
Addict
Posts: 1027
Joined: Sun May 15, 2005 5:15 am
Location: Australia
Contact:

Post by lexvictory »

look for info on "hooks"
Demonio Ardente

Currently managing Linux & OS X Tailbite
OS X TailBite now up to date with Windows!
mikecaliber
User
User
Posts: 22
Joined: Sun Feb 15, 2004 5:34 pm

Post by mikecaliber »

you can do a google search for microsoft virtual keycodes

not sure if this is what you need but it works for these instances:


If GetAsyncKeyState_(#VK_LBUTTON)<>0

will detect if the left mouse button is down, no matter which window has the focus. #VK_LBUTTON is the virtual key code. There are other keycodes for the mouse and for keyboard, etc.

There's more about mouse events at:

viewtopic.php?t=17492

hope this helps and if not, good luck-

best,
mike
Nueng
User
User
Posts: 35
Joined: Fri May 27, 2005 11:16 am

Post by Nueng »

Thank you All :)
\\ (^O^) //

Thank god for send you to Help me..
Post Reply