Link to home
Start Free TrialLog in
Avatar of SnowyB
SnowyB

asked on

Launch app from TService application

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,

Andy.
ASKER CERTIFIED SOLUTION
Avatar of geobul
geobul

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of SnowyB
SnowyB

ASKER

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