Re: shellexecuteex in windows service, to run the app persistently
- From: "Bruno van Dooren [MVP VC++]" <bruno_nos_pam_van_dooren@xxxxxxxxxxx>
- Date: Sun, 23 Jul 2006 10:50:14 +0200
Basically i'm using this shellexecuteex within servicestart(). my idea is
when the application is closed by the user it would read 'goto restart'
and
restart the application again but instead it just stops the service itself
VOID ServiceStart (DWORD dwArgc, LPTSTR *lpszArgv)
{
restart:
ShellExecuteEx(&ShExecInfo);
WaitForSingleObject(ShExecInfo.hProcess,INFINITE);
goto restart
}
You don't perform any error checking after ShellExecuteEx. How do you know
that it succeeded?
Please check the return value, and use GetLastError appropriately.
Another thing: while I am absolutely not opposed to using goto in code for
clarity, using goto like this is ugly IMO.
It would be better to use a loop, and use the return value of ShellExecute
as the loop variable that determines if the loop has to repeat or not.
--
Kind regards,
Bruno van Dooren
bruno_nos_pam_van_dooren@xxxxxxxxxxx
Remove only "_nos_pam"
.
- References:
- Re: shellexecuteex in windows service, to run the app persistently
- From: JJ
- Re: shellexecuteex in windows service, to run the app persistently
- From: ganesh
- Re: shellexecuteex in windows service, to run the app persistently
- From: JJ
- Re: shellexecuteex in windows service, to run the app persistently
- From: ganesh
- Re: shellexecuteex in windows service, to run the app persistently
- Prev by Date: Re: GlobalUnlock doesn't unlock Memory object
- Next by Date: Re: Getting cout<<fixed to work.
- Previous by thread: Re: shellexecuteex in windows service, to run the app persistently
- Next by thread: Re: Mixing Release and Debug binaries
- Index(es):