How to programmatically launch a service on Windows 7?
Posted on 2010-04-06
On Windows XP, I have code to install and launch a service, and this code is very simple,
basically it is this:
HINSTANCE h1 = ShellExecute(NULL, _T("open"), "Mets", "-i", "C:\\Foo\\Dics", NULL);
HINSTANCE h2 = ShellExecute(NULL, _T("open"), "Mets", "-s", "C:\\Foo\\Dics", NULL);
This launches C:/Foo/Dics/Mets.exe to run as a service.
But this seems not to work on Windows 7. The service does not start running. It is a service
without a GUI.
So, how to do this for windows 7? Ideally, one set of code that would work for both XP
and win7. What am I missing?