Posted By: obrienslalom | Apr 22nd @ 9:42 AM
page 1 of 1
Comments: 2 | Views: 653
obrienslalom
obrienslalom
(2 2 2 3) *3 | 3 3 3

I wrote an application to launch a bunch of instances to application 'X' (through a shell command).  The program is responsible for repositioning the windows once I have retrieved their hwnds.  My question is, what is the best way to wait for the application to actually create the window.  Right now I'm just waiting until I can find it using EnumWindows.  Obviously, I can run into some problems here, especially since sometimes the title is identical across multiple instances.

-I can probably associate them with the pid that is launched.
-Is there a callback that I can get a notification when a new window is created?

Let me know if you have any thoughts.

Matthew van Eerde
Matthew van Eerde
AKA Maurits
You could listen for accessibility events. See SetWinEventHook.

http://msdn.microsoft.com/en-us/library/dd373619(VS.85).aspx

EDIT: specifically, EVENT_OBJECT_SHOW is probably what you're interested in.
page 1 of 1
Comments: 2 | Views: 653
Microsoft Communities