开发者

Showing HTML Help (chm) from interactive service on XP

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 runni开发者_开发知识库ng 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);


Finally found an answer to this:

Under the registry key:

HKLM\SOFTWARE\Microsoft\HTMLHelp\1.x\HHRestrictions

Make a new DWORD value key:

EnableNonInteractiveUser

And set the value to 1.

This will allow an interactive service process on XP to show HTML Help.

If your service process is already running you may need to restart it before this will work (the need to do this or not depends on how your program run-time system starts the HTML Help viewer - cached results mean that it might not work until restart.)

At this stage its unknown to me if the same change will work for Vista, Win7 or Win8.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜