.:: Bots United ::.

.:: Bots United ::. (http://forums.bots-united.com/index.php)
-   General Programming (http://forums.bots-united.com/forumdisplay.php?f=25)
-   -   hook on window events? (not self) (http://forums.bots-united.com/showthread.php?t=2733)

Pierre-Marie Baty 02-10-2004 16:35

hook on window events? (not self)
 
Hi

I need to know how to hook on certain window events, but not for a hWnd of my program, for another window on the desktop. Let's say, for example, that I want my application to know when I click on the minimize button of this IE window (or any other window).

I know this is possible. I have a little app running here that does the same thing for Outlook Express, it hides OE in the systray when I click minimize, and fires it up again when I click on its icon in the systray. Unfortunately I don't have the source code for it. And I need to do just that in my program.

I know how to use EnumWindows() to find the handle of a particular window on the desktop, now I just want to know how to have a callback function called when a certain event occurs in this window. Polling is out of question :(

Any ideas ?

Lazy 02-10-2004 17:15

Re: hook on window events? (not self)
 
You can use SetWindowsHookEx to load a dll into the target process, from the dll you export a new window procedure where you can check for windows messages.

I'll see if I can find a code sample somewhere, if not I'll write one myself.

Added:
Here's one...
http://www.codeproject.com/system/Mi...ndowToTray.asp

Pierre-Marie Baty 02-10-2004 22:30

Re: hook on window events? (not self)
 
Thanks a lot, that was just what I needed =)


All times are GMT +2. The time now is 16:29.

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.