How can I open a help file (chm or so) fro

2019-07-23 00:57发布

问题:

I'm trying to add some help to my GUI developed in VC++ 2008. I want to compile a chm file, or a hlp file that can be accessed from my menu. Anyone can give me any idea about how to do this?

Thanks a lot

回答1:

Under HKLM\Software\Microsoft\Windows\HTMLHelp , create an entry
named help.chm
value C:\path to\help file.chm

Then to open the chm at a particular topic call

 HtmlHelp(m_hWnd, "Help.chm", HH_DISPLAY_TOPIC, NULL);


回答2:

You could just ShellExecute the .chm file. That will open it.

ShellExecute( hWnd, _T( "open" ), _T( "help.chm" ), NULL, NULL, SW_NORMAL );


回答3:

Sorry, I misunderstood your question earlier.

For opening the Help file, you can use WinHelp

Some Links:

First (PDF)
Second
Third

There are some issues with WinHelp in Windows Vista and Win2K8, For details on how to deal with them, Look here



回答4:

If you are using managed C++:

In the namespace

System.Windows.Forms

you can find the class Help with static methods ShowHelp, ShopHelpIndex

More info: http://msdn.microsoft.com/en-us/library/system.windows.forms.help.aspx

If you are using unmanaged C++ (WIN32 api):

You can just launch the *.chm file. Example how to do it you can find here: How do I call ::CreateProcess in c++ to launch a Windows executable? . Or here http://www.codeproject.com/KB/system/newbiespawn.aspx