•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the C++ section within the Software Development category of DaniWeb, a massive community of 426,815 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 1,924 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C++ advertiser: Programming Forums
Views: 314 | Replies: 8
![]() |
•
•
Join Date: Jul 2008
Posts: 5
Reputation:
Rep Power: 0
Solved Threads: 0
Hi,
This concerns Microsoft Windows. I want to know when a window from other processes is made visible. Also, I want the handle of the window. I've tried to catch the message WM_SHOWWINDOW with SetWindowsHookEx(WH_GETMESSAGE, &MessageProc, g_hInstance, 0) but I receive no events ! The only events I receive is when I do a call to MessageBox after the call to SetWindowsHookEx. But the events only come from user32.dll. I call MessageBox to tell me that the call to SetWindowsHookEx is successful. Please, I need your help. Thank you.
This concerns Microsoft Windows. I want to know when a window from other processes is made visible. Also, I want the handle of the window. I've tried to catch the message WM_SHOWWINDOW with SetWindowsHookEx(WH_GETMESSAGE, &MessageProc, g_hInstance, 0) but I receive no events ! The only events I receive is when I do a call to MessageBox after the call to SetWindowsHookEx. But the events only come from user32.dll. I call MessageBox to tell me that the call to SetWindowsHookEx is successful. Please, I need your help. Thank you.
•
•
Join Date: Oct 2007
Location: Cherry Hill, NJ
Posts: 1,876
Reputation:
Rep Power: 11
Solved Threads: 193
•
•
Join Date: Jul 2008
Posts: 5
Reputation:
Rep Power: 0
Solved Threads: 0
•
•
•
•
You have to hook external objects using global hooks (those residing in a DLL). Process hooks can only be used with your own application's processes.
Sorry, but I don't understand. My hook is already in a DLL, or do you mean that exists other hook functions that are more global to the system ? What I don't understand, is this is supposed to work according to Microsoft documentation :
•
•
•
•
Originally Posted by Platform SDK: Windows User Interface
SetWindowsHookEx
...
These events are associated either with a specific thread or with all threads in the same desktop as the calling thread.
•
•
Join Date: Oct 2007
Location: Cherry Hill, NJ
Posts: 1,876
Reputation:
Rep Power: 11
Solved Threads: 193
I'm sorry, I mixed-up that last two arguments to SetWindowsHookEx() and thought you were installing a process hook.
The WM_SHOWWINDOW message is not a queued message --it is sent directly to the target window procedure. Hence, the WH_GETMESSAGE hook will never see it. You'll need to install a WH_CALLWNDPROC hook to catch it.
Annoying, isn't it?
(Sorry it took me this long to pay enough attention to answer your question...)
The WM_SHOWWINDOW message is not a queued message --it is sent directly to the target window procedure. Hence, the WH_GETMESSAGE hook will never see it. You'll need to install a WH_CALLWNDPROC hook to catch it.
Annoying, isn't it?
(Sorry it took me this long to pay enough attention to answer your question...)
•
•
Join Date: Apr 2008
Posts: 27
Reputation:
Rep Power: 0
Solved Threads: 4
see news://194.177.96.26/comp.os.ms-wind...ogrammer.win32
where it has been explained hundreds of times...
where it has been explained hundreds of times...
•
•
Join Date: Jul 2008
Posts: 5
Reputation:
Rep Power: 0
Solved Threads: 0
•
•
•
•
see news://194.177.96.26/comp.os.ms-wind...ogrammer.win32
where it has been explained hundreds of times...
If you know how, it will be great that you explain it here. Newsgroups have no archives as I know. If I ask it here, it's because I found nothing. This will take you 5 minutes or less.
•
•
Join Date: Oct 2007
Location: Cherry Hill, NJ
Posts: 1,876
Reputation:
Rep Power: 11
Solved Threads: 193
Newsgroups are archived. For ever and ever. (But they are annoying to search.)
No, you tried WH_CALLWNDPROCRET, which is entirely different.
If you are still having problems I'll see if I can't compile your code myself and figure out what's wrong.
•
•
•
•
Yes, I already tried WH_CALLWNDPROC with no luck. Please, see the file attachment to my first message.
If you are still having problems I'll see if I can't compile your code myself and figure out what's wrong.
![]() |
•
•
•
•
•
•
•
•
DaniWeb C++ Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Similar Threads
- memory management in wndows 2000 (Windows NT / 2000 / XP / 2003)
- Browser opening by itself. (Viruses, Spyware and other Nasties)
- Highjack file Ie wont download (Viruses, Spyware and other Nasties)
Other Threads in the C++ Forum
- Previous Thread: Library function
- Next Thread: random number guess



It was supposed to be a simple program to practice and learn C/C++. It's developped under Visual Studio .NET 2002. I'll do cleanup when the hook will work.
Linear Mode