Hooking into mouse messages in a Command/MSDOS window
-
I wrote a simple app that hooks WH_MOUSE events. The application receives a stream of events when the mouse is moved over most windows. However it does not get any events from: - the Command (MSDOS) application - the menu bar of old (16-bit?) applications such as Calculator or Paint. - the title bar of all apps How can catch mouse messages in these cases? -- Goop
-
I wrote a simple app that hooks WH_MOUSE events. The application receives a stream of events when the mouse is moved over most windows. However it does not get any events from: - the Command (MSDOS) application - the menu bar of old (16-bit?) applications such as Calculator or Paint. - the title bar of all apps How can catch mouse messages in these cases? -- Goop
Please mention the problem clearly.
-
Please mention the problem clearly.
Mmm, I thought I had :-) It seems that the Command/MSDOS window is capturing mouse movements before my application. As my application was started from that window, I assumed that my app would be earlier in the hook list and therefore receive messages first. But the app does not see the mouse movements for the Command window. I guess the problem goes deeper, because I want to see ALL mouse movements, wherever my hook is in the hooks list. So I guess I need to get the messages before any hook functions. Hope that is clearer :-) Regards -- Goop
-
I wrote a simple app that hooks WH_MOUSE events. The application receives a stream of events when the mouse is moved over most windows. However it does not get any events from: - the Command (MSDOS) application - the menu bar of old (16-bit?) applications such as Calculator or Paint. - the title bar of all apps How can catch mouse messages in these cases? -- Goop
Command/DOS applications do not have a message loop. But you should get mouse messages on title bars of Windows apps using this hook. If not you should try
WH_MOUSE_LL
.«_Superman_»
-
Command/DOS applications do not have a message loop. But you should get mouse messages on title bars of Windows apps using this hook. If not you should try
WH_MOUSE_LL
.«_Superman_»
Thanks for your reply. You are right, messages really are received on title bars. I needed to test for the Non-Client messages, WM_NCRBUTTONDOWN, as well as for WM_RBUTTONDOWN. This also fixes it for the menu bars of Calculator/Paint. But the Command/MSDOS window still somehow captures messages - I see none of them, even for the title bar. How does it do this (ie. which API)? Does this mean that keyloggers also cannot intercept text typed into the Command window? This would imply that an application should grab the keyboard events directly (as in Command) to avoid snooping, eg during password entry. Regards -- Goop