Link to home
Start Free TrialLog in
Avatar of derekthompson
derekthompson

asked on

How to determine if a program that i have started has finished loading

I need to know how to determine if a program that i have started with a call to CreateProcess() has finshed loading. I have developed a program that starts and stops programs all over a network and need to send messages to tell the programs to turn on or off but have to wait until they are through loading or sometimes the message isnt processed. I have the ProcessId, ThreadId and Handle of each program and am at this point saving their titles and sending the message after i find the title on the screen (very inefficient). If any one can help...
ASKER CERTIFIED SOLUTION
Avatar of cookre
cookre
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of derekthompson
derekthompson

ASKER

im running some tests with this now but i dont think this is really any different that what im using now to detect if its been started, while (!IsWindow(hWnd)), the problem (i think) is the programs i am starting are all written in VB and are loading a common DLL they are using to load their window frame so if you watch real closely you can see the window actually change its name form ShellClient to the program name. If they receive a message during this time to start processing, for some resaon the message isnt processed (sending a msg of VK_F5 to start processing) which im pretty sure is due to the shellclient dll being loaded. The problem would be pretty simple to solve if the stupid things didnt take so long to load the dll. Some times a program can take as long as 30 sec to open (how inefficient is that) and other times the same program will open in less than a second. I put a timer in my program for a delay but its inefficient because of the inconstency of the time it takes to start up the other programs which results in A.my program seems slow because im waiting too long for other programs to start or B.not all of the programs start processing. I thought getting the actual title from the window for each added program would do the trick but i can watch in task manager and see the name of the program but it isnt on the screen yet which im pretty sure is when my program is sending the F5 message and its getting ignored. At this point i feel the only hope i have is if i can somehow tell if the window is actually visible to the user (if this is possible) but im not really for sure of anything. all comments are appreciated i still may be going down the wrong path