I am developing an application for PocketPC 2003 and Windows Mobile5 written
in C++.
I need to start a process (the wceload exactly) and I would like to block
the calling application until the process has ended.
I am using the CreateProcess function.
Any suggestion?
Thanks.
D.
--
Michael Salamone [eMVP]
Entrek Software, Inc.
www.entrek.com
"Dario Salvi" <dsa...@lst.tfo.upm.es> wrote in message
news:450e...@news.upm.es...
it worked !
great !
Some code:
HANDLE findfile = FindFirstFile(FileName,&ffile);
LPPROCESS_INFORMATION procInf;
procInf = new PROCESS_INFORMATION;
CreateProcess( L"\\Windows\\wceload.exe", L" /noui /nodelete
\\\%s\\Installations\\%s\", NULL, NULL, NULL, NULL, NULL, NULL, NULL,
procInf))
WaitForSingleObject((*procInf).hProcess, INFINITE);
If you do allocate from the heap, don't forget to check that you actually
got some memory - and to free it! Check the return from CreateProcess, too.
And, make sure you close the hProcess and hThread handles returned in
PROCESS_INFORMATION.
Some better code:
HANDLE findfile = FindFirstFile(FileName,&ffile);
PROCESS_INFORMATION procInf;
if (CreateProcess(L"\\Windows\\wceload.exe", L" /noui /nodelete
\\\%s\\Installations\\%s\", NULL, NULL, NULL, NULL, NULL, NULL, NULL,
&procInf))
{
WaitForSingleObject(procInf.hProcess, INFINITE);
CloseHandle(procInf.hProcess);
CloseHandle(procInfo.hThread);
}
Check return from FindFirstFile, too! And close with FindClose.
--
Michael Salamone [eMVP]
Entrek Software, Inc.
www.entrek.com
"Dario Salvi" <dsa...@lst.tfo.upm.es> wrote in message
news:4510...@news.upm.es...