Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Monitor Windows 1

Status
Not open for further replies.

LuckyLuke

Programmer
Mar 28, 2001
188
NL
Hi,

I was wondering if there's a way you can monitor new windows opening without using timers? I can't help it, I have something against timers lol :)

LuCkY
 
LuckyLuke,
Sorry if I keep repeating my answers, but once again this is something that you could use SetWindowsHookEx in a C++ DLL with a callback to your VB program. The messages that you are going to want to respond to are WM_CREATE, and WM_SHOWWINDOW.
Remember that alot of what you have been trying to do up here is to efficiently monitor the system while it is running. To really do that well, you need to understand how the Windows OS really works . . . almost everything that happens in windows is going to have a message posted to an Event Queue . . . so it only makes sense that the best way to monitor the entire system is by monitoring the event queues. - Jeff Marler B-)
 
LuckyLuke,
I had one more comment/suggestion for you . . . do you have Spy++ installed on your PC? Its an app that comes with Visual Studio and it will allow you to monitor any mesages sent to any event queue for any window . . . it is really useful when you are writing code that works with the OS event queues. If have not used it before, take a look at it. - Jeff Marler B-)
 
What do I have to hook? Like the keyboard and mouse are hooked to WH_MOUSE and WH_KEYBOARD. But what about windows?
 
I would look at using WH_SHELL. If you get a chance, take a look at "Windows NT WIN32 API Superbible" (Publisher : The Waite Group, ISBN : 1-57169-089-1). They have a great chapter devoted just to how the event queues work and how to hook into any of them as well as all of the other WIN32 APIs . . . all of the code is in C++ though. - Jeff Marler B-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top