Jump to content

Mouse Hook


Recommended Posts

Hello again,

I'm programming a dll that captures the mouse click with hooks.

I want to capture the left, right and middle click mouse. I have tried with WH_MOUSE, WH_MOUSE_LL hooks.... but my program captures the movements of the mouse, not the click mouse.

I do the following:

hkb = SetWindowsHookEx(WH_MOUSE, HookMouseProc, (HINSTANCE)g_hModule, 0);

And to capture the mouse clicks:

if((wParam != NULL) && (lParam != NULL))
{
if ((wParam == WM_LBUTTONDOWN) || (wParam == WM_MBUTTONDOWN) || (wParam == WM_RBUTTONDOWN)){
...................................
}

I think that I don´t capture the correct signal in if.... But I don´t know wich signals are the correct ones :paperbag1:

Thanks in advanced :friends:

Link to comment
Share on other sites

Hi Carlos!

You are right. These are not the correct messages.

Here you have the good ones:

if((wParam != NULL) && (lParam != NULL))
{
if ((wParam == MK_LBUTTON) || (wParam == MK_MBUTTON) || (wParam == MK_MBUTTON){
...................................
}

Good Luck ;)

Hello again,

I'm programming a dll that captures the mouse click with hooks.

I want to capture the left, right and middle click mouse. I have tried with WH_MOUSE, WH_MOUSE_LL hooks.... but my program captures the movements of the mouse, not the click mouse.

I do the following:

hkb = SetWindowsHookEx(WH_MOUSE, HookMouseProc, (HINSTANCE)g_hModule, 0);

And to capture the mouse clicks:

if((wParam != NULL) && (lParam != NULL))
{
if ((wParam == WM_LBUTTONDOWN) || (wParam == WM_MBUTTONDOWN) || (wParam == WM_RBUTTONDOWN)){
...................................
}

I think that I don´t capture the correct signal in if.... But I don´t know wich signals are the correct ones :paperbag1:

Thanks in advanced :friends:

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy