Re: WaitForSingleObject returns immediately

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Oh sorry, I should have explained that. Here's its definition:
void *startInfo = NULL;
#if !defined WINCE
STARTUPINFO si;
memset(&si, 0, sizeof(si));
startInfo = &si;
#endif

I don't like to spread #ifdef statements inside the functions and this way
the rest of the function is pretty much the same for both WIN32 and WINCE.
Anyway, using NULL instead of startInfo doesn't solve the problem.

Right now I'm using a device with Windows CE .NET and evc4, but my goal is
to make the application compatible with Windows CE 3.0 and above.


Fabio.



"Paul G. Tobey [eMVP]" wrote:

Not sure, but startInfo is not supported, according to the help I have.
What's that set to? What version of Windows CE are we talking about?

Paul T.

"Fabio" <Fabio@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:0C785499-92D4-472B-9C4A-EAFDEF8E7EB2@xxxxxxxxxxxxxxxx
Hi.

I'm making an application that needs to launch an external application and
wait until it is closed to continue. Here's is the code:

if (!(ret = !CreateProcess(szCommand, szArgs, null, null, false, 0,
null,
null, startInfo, &processInfo)))
{
WaitForSingleObject(processInfo.hProcess, INFINITE);
GetExitCodeProcess(processInfo.hProcess, &ret);
}
CloseHandle(processInfo.hThread);
CloseHandle(processInfo.hProcess);
}

It works in WIN32 with any application and works in WINCE when the
application launched is the HelloWorld example created by evc4 using the
new
project wizard. However, it does not work in WINCE when I call other
applications, like iexplore, notes, pword, fexplore, etc...
Instead of waiting, the function returns immediately the value
WAIT_OBJECT_0
and GetExitCodeProcess fills the ret variable with 0, even though the
process
is still running.

What should I do to make it work as expected?

Thanks in advance.



.



Relevant Pages

  • Re: WaitForSingleObject returns immediately
    ... closed programs on the list. ... The first time my application tries to launch another application, ... void *startInfo = NULL; ... the rest of the function is pretty much the same for both WIN32 and WINCE. ...
    (microsoft.public.windowsce.app.development)
  • Re: WaitForSingleObject returns immediately
    ... void *startInfo = NULL; ... the rest of the function is pretty much the same for both WIN32 and WINCE. ... Right now I'm using a device with Windows CE .NET and evc4, ... I'm making an application that needs to launch an external application ...
    (microsoft.public.windowsce.app.development)
  • Re: WaitForSingleObject returns immediately
    ... it's Windows CE, it should work correctly. ... The first time my application tries to launch another application, ... void *startInfo = NULL; ... #if!defined WINCE ...
    (microsoft.public.windowsce.app.development)
  • Re: WaitForSingleObject returns immediately
    ... Paul T. ... void *startInfo = NULL; ... the rest of the function is pretty much the same for both WIN32 and WINCE. ... Right now I'm using a device with Windows CE .NET and evc4, ...
    (microsoft.public.windowsce.app.development)
  • Re: WaitForSingleObject returns immediately
    ... This is Windows CE or Windows Mobile? ... you're not launching anything, really. ... void *startInfo = NULL; ... #if!defined WINCE ...
    (microsoft.public.windowsce.app.development)