Launch device app and wait

  • Thread starter Thread starter mike
  • Start date Start date
M

mike

My desktop calls uses CeCreateProcess to launch an exe on
the device, and in order to wait, i keep checking a
registry entry to see if the device app has finished.
This seems kind of messy.

Is there a way to launch an application on the device and
wait for it to finish before continuing the calling thread
on the desktop?

I have tried varying combinations of WaitForSingleObject,
WaitForDebugEvent, CeCreateProcess, and CeRapiInvoke (okay
I can't do this because my device app is a CF exe, not a
eVC dll).

This seems to be a necessary feature and it's odd that
either nobody has figured out a way to do it, there isn't
a way to do it, or nobody wants to offer any assistance.

anyone... please, .. for the love .... of ....
*help*
 
CeCreateProcess is not part of the .NET framework. Maybe you should check

"microsoft.public.pocketpc.developer"

The Thread class is suported in the .NET compact framework. If you create a
new thread from the main thread you can use the Join() method of the child
thread to wait for it to complete. However, I don't think that will work
with your CeCreateProcess(). You can alternatively use the static
Thread.Sleep() method on your calling thread.

<your CeCreateProcess call here>
for (;;)
{
<check for completion>
Thread.Sleep(5000); //wait 5 seconds before checking again
}
<continue rest of your method here>

Also the Process class has a convienient WaitForExit() method. However,
that is not available in the compact framework.
 
Yeah, it's not so much getting the right API calls as it
is the .Net implimentation of them. I figured I could get
a pointer about how to P/Invoke the right API. For that
reason I decided to post the question to the .Net group.
Maybe I could have posted it to the Interop group, but
that is a member of the Framework group.

I do appreciate your suggestion, but that is what I
already have. The "<check for completion>" part is
reading a registry entry that the device app writes to on
completion. Like I said in the original post, it seems a
bit messy.
 
Back
Top