How to detect double-click on desktop window?
-
Hello! I'm trying to find out how to detect double clicks on desktop screen. I could use GetKeyState() and make some calculations to detect 'global' double-click, but this would include clicks on buttons, icons and other items. I want to detect ONLY that double-clicks which are not connected with any action (those messages which system is not passing to any other application neither interpret by its own like double-clicks on icons). Should I use global hooks? SetWindowsHookEx(WH_MOUSE, MouseProc, tInstance, NULL) would fit if I could filter-out application/icons connected doubleclicks. Thanks for any help:) Pat
-
Hello! I'm trying to find out how to detect double clicks on desktop screen. I could use GetKeyState() and make some calculations to detect 'global' double-click, but this would include clicks on buttons, icons and other items. I want to detect ONLY that double-clicks which are not connected with any action (those messages which system is not passing to any other application neither interpret by its own like double-clicks on icons). Should I use global hooks? SetWindowsHookEx(WH_MOUSE, MouseProc, tInstance, NULL) would fit if I could filter-out application/icons connected doubleclicks. Thanks for any help:) Pat
This is a complete SWAG, but once you detect a mouse click on a window, can you check to see if: 1) it has no parent, and 2) it belongs to the "#32769" class?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
-
This is a complete SWAG, but once you detect a mouse click on a window, can you check to see if: 1) it has no parent, and 2) it belongs to the "#32769" class?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
Hmmm... Lets assume hooking to the global mouse messages via SetWindowsHookEx(WH_MOUSE,....). I would get ALL mouse messages. Is this MSG structure enough to detect double-click on 'free' desktop window? typedef struct { HWND hwnd; UINT message; WPARAM wParam; LPARAM lParam; DWORD time; POINT pt; } MSG, *PMSG; My pseudo-code would be like this: if((pMsg->message==WM_LBUTTONDBLCLK) && (pMsg->hwnd==::GetDesktopWindow())) { // we've got double-click on desktop, not on any other window/icon?? } Do You think that's enough? I wonder what pMsg->hwnd would be if I double-click on "my computer" icon?? Would it be the same? (::GetDesktopWindow()) Pat.
-
Hmmm... Lets assume hooking to the global mouse messages via SetWindowsHookEx(WH_MOUSE,....). I would get ALL mouse messages. Is this MSG structure enough to detect double-click on 'free' desktop window? typedef struct { HWND hwnd; UINT message; WPARAM wParam; LPARAM lParam; DWORD time; POINT pt; } MSG, *PMSG; My pseudo-code would be like this: if((pMsg->message==WM_LBUTTONDBLCLK) && (pMsg->hwnd==::GetDesktopWindow())) { // we've got double-click on desktop, not on any other window/icon?? } Do You think that's enough? I wonder what pMsg->hwnd would be if I double-click on "my computer" icon?? Would it be the same? (::GetDesktopWindow()) Pat.
Use spy++ utility and check the message(s) when double-clicking My computer icon. Me I think the message is for the SHELLDLL_DefView/SysListView32 classes that displays the icons, and not for #32769 desktop window.