|
-
March 9th, 2004, 11:23 AM
#1
Create Process Problem
Hi,
Don't know whether any body will be able to help. I am using CreateProcess() to open another application from mine.
The application that is opening has a splash screen. What I need to do is wait for the program to open and then send some keyboard messages.
I am currently using Sleep() to wait for a number of seconds while the application loads. My problem is that the Splash Screen stays until my Sleep() call is over. If I sleep for 1 second or 30 seconds.
Does anybody know why? and how to solve the problem?
Thanks
-
March 9th, 2004, 11:45 AM
#2
Use the WaitForInputIdle function
if ( WaitForInputIdle(processinfo.hProcess,30000)!=0 ) {
return 0;
}
-
March 9th, 2004, 01:35 PM
#3
Yes, you should use WaitForInputIdle instead of Sleep. However I am not sure if that is what you are asking for but I don't know what you you are asking for.
-
March 9th, 2004, 02:08 PM
#4
The problem is that I need an application to start and then to send it some keyboard input before I start using it.
The problem is that the application that I am starting has a splash screen that is displayed while the application initialises. I do not want to send the keyboard input until the application main window is being displayed. (Hope this explains better)
I have tried WaitForInputIdle() but the this returns once the application has started opening and not when the Application Intialisation has completed and the main window showing.
Any ideas?
-
March 9th, 2004, 02:13 PM
#5
Have a registry entry that establishes when the initialization is complete and then only send your input.
-
March 9th, 2004, 02:16 PM
#6
I think you mean that in the Application that I am starting I should do this? (Only problem is that this is a thrid party program.) or do you mean someting else?
Could you explain more please,
Thanks
-
March 9th, 2004, 02:27 PM
#7
You could call FindWindow or FindWindowEx in your calling program to check whether the other programs window has been created or not.
-
March 9th, 2004, 02:41 PM
#8
So what establishes that the third party is initialized. Detect that if you can and then only send your input. Either find window or EnumWindows should do the work.
-
March 9th, 2004, 02:43 PM
#9
I assume the splash screen shows without any other windows for the application showing. Is the desktop the parent of the splash screen? You can use Spy++ to determine the parent. If so, then you can probably use EnumDesktopWindows to find the splash screen. You probably will need to delay doing that; if it were me, I would probably do that in a loop with a delay of a half a second or so between every enumeration of the desktop windows. Or if there is enough idenifying characteristics you can use FindWindow or something similar.
Once the splash window is found, you can check periodically to see if it is still there.
If you want to get fancy, you could set a windows hook for that process (thread actually) to monitor things.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|