views:

5

answers:

0

I have a C++ App than can optionally run as Windows Service on XP and interacts with the Desktop (yes, I know it's bad practice but it's been around for a long time!)

Retrofitting html help to it I've discovered HtmlHelp() doesn't work from a service. I've tried running hh.exe using CreateProcess() and ShellExecute() with no success. On the other hand, running Write using CreateProcess works fine, so there must be something different about hh.exe. No amount of googling has shed any light. How can I fire up a chm file from a service?

PROCESS_INFORMATION ProcInfo;
STARTUPINFO si;
memset(&si, '\0', sizeof(STARTUPINFO));
si.cb = sizeof(STARTUPINFO);
//si.lpDesktop = "winsta0\\default"; // <-- doesn't make any difference
char *helpcmd = "hh.exe c:\\help\myhelpfile.chm";
BOOL bSuccess = ::CreateProcess(NULL, helpcmd, NULL, NULL, FALSE, 0, NULL, NULL, &si, &ProcInfo);