Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
C++ - Please tell me how to setup global hook for WM_MDITILE
I know everyone is off to great mobile or web type work. Well, I'm stuck here on some good old C++. Here's whats bugging me.
I want my application to do a certain thing when the user presses the menu "Tile Vertically" in another app (in another process). (Many apps have a menu "Windows" and underneath that is a sub menu "Tile Vertically"). I'm under the assumption that I need to setup a global hook using SetWindowsHookEx. I tried doing that using "WH_CALLWNDPROC" and was only able to hook to "in process" messages, not "out of process". I tried WH_GETMESSAGE as well. I tried catching WM_SIZE, that also did not work out of process. In fact, even in process, WM_SIZE didn't work on all windows , only on some of them.
So now there are a few questions:
1- What is the right type of hook (WH_CALLWNDPROC or WH_GETMESSAGE or perhaps one of the other hook types that can be used)?
2- How do I get it to pick up out of process messages?
3- Any tips where I can get sample hook code for WM_MDITILE?
4- I tried doing a keyboard hook and that worked, why doesn't this work?
5- I'm using a win 32 dll with the DllMain code below. Is there anything wrong with it?
BOOL APIENTRY DllMain( HMODULE hModule,
// Capture the application instance of this module to pass to
// hook initialization.
if (hinst == NULL)
hinst = hModule;
Any tips or suggestions?
0 · ·