Launch app from TService application

SnowyB used Ask the Experts™
Hi there,

I'm trying to create a service that needs to execute an exe file.  I'm trying to do this with ShellExecute and this works fine in a standard application, but not in a service application.  The application is launched and appears under Processes in Task Manager but is not visible to the user.  I wasn't sure what to pass to ShellExecute as the handle, so have been passing 0:

ShellExecute(0, 'open', PChar(RunCommand), PChar(RunParameters), PChar(ExtractFilePath(RunCommand)), SW_SHOWNORMAL);

I've messed about with various options so the service runs under the system account or a user account, but these options seem to make no difference.

If anyone could help with this, I'd really appreciate it as there seems to be little in the way of documentation for service applications.

Thanks very much in advance,

Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Hi Andy,

Try 'Local System Account' with 'Allow Service To Interract With Desktop' checkbox checked.

Regards, Geo


Thanks very much Geo, worked first time!
You are welcome. Good luck
That will not work on windows Vista, the support for interactive process is being dropped

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial