各位大虾:
    小弟写了一个CHM格式的Help,并可通过HtmlHelp()函数从程序中将其叫出来,但是,有一个问题一直不能解决,我想让叫出的Help根据从不同的地方叫出而出现不同的画面。
就像联机帮助一样,在这一步叫出的Help,应出现一种画面,而在下一步叫出的Help,应出现另一种画面。
    我已在Help中定义好的各个ID号,还请各位大虾指点迷津。

解决方案 »

  1.   

    About HTML Help URLs
    Many of the HTML Help API commands require that you specify an HTML Help URL in the pszURL parameter.An HTML Help URL specifies a compiled help (.chm) file or a topic within a help file. Usually, a window type in which to display the HTML Help URL is also specified.Specifing an HTML Help URL
    The following example shows the syntax to display a compiled help file:Helpfile.chm[>Window name] where Helpfile.chm is the name of the compiled help file and Window name is the name of the help window in which you want the topic to appear.To specify a topic within a compiled help file, use the following syntax:Helpfile.chm::/Topic.htm[>Window name] where Helpfile.chm is the name of the compiled help file, Topic.htm is the name of the HTML file that you want to open and Window name is the name of the help window in which you want the topic to appear.Specifing a topic file path
    A compiled help file retains the folder structure in which it was organized before compilation, unless the option to compile flat has been selected.For example, if a project is organized in three folders (one for HTML files, one for images, and one for style sheets), the help file will contain those same folders internally. The folder in which the project file resides is considered the root. To correctly link to a topic file, you must specify the full path. The following example specifies an overview topic:Helpfile.chm::/Html/Overview/Topic.htm[>Window name] where Overview is a folder within the Html folder.Notes
    When coding an HTML <A> tag in an HTML file, or when specifying a compiled help file path in the HTML Help ActiveX control, you must include the prefix ms-its, which determines where the help file resides on a user's computer. The prefix ms-its is a pluggable protocol that follows standards set up by the World Wide Web Consortium (W3C). The ms-its protocol works with Microsoft Internet Explorer 4.0 or later, but is not supported in all browsers. 
    The prefix mk:@MSITStore is an earlier version of the ms-its protocol that works with Microsoft Internet Explorer 3.0 or later. 
    The following examples show the syntax to use when including the prefix: 
    ms-its:Helpfile.chm::/Topic.htm[>Window name]mk:@MSITStore:Helpfile.chm::/Topic.htm[>Window name]
      About the HTML Help API  
       
    --------------------------------------------------------------------------------
    Send feedback to MSDN.Look here for MSDN Online resources.
      

  2.   

    在制作好chm文件后,你可以使用HWND HtmlHelp(HWND hwndCaller, LPCSTR pszFile, UINT uCommand, DWORD dwData)函数在应用程序中调用它。    要使用HtmlHelp()函数,你需要使用HTML Help WorkShop目录下的htmlhelp.h以及htmlhelp.lib文件。这两个文件分别在安装HTML Help WorkShop的时候已经一起安装在了HTML Help WorkShop的目录下的include和lib目录中,在你工程中添加这两个文件。并在使用HtmlHelp()函数的文件中包含htmlhelp.h。你就可以使用HtmlHelp()函数了。HWND HtmlHelp(HWND hwndCaller, LPCSTR pszFile, UINT uCommand, DWORD dwData)函数返回显示帮助文档的窗口句柄。此函数共用四个参数:HWND hwndCaller 为调用窗口的句柄。LPCSTR pszFile 帮助文档的文件名。可以是HTML文件,URL,chm文件等。UINT uCommand 指定具体的操作命令,HtmlHelp()能够完成很多不同的操作,uCommand用于指定要进行什么样的操作,最常用的是显示某个帮助主题:HH_DISPLAY_TOPIC。DWORD dwData 用于给出一些uCommand所需的附加数据。如果不需要,可以指定为NULL。例:
    CString szHelpFile = "c:\\help.chm::/index.htm";
    HWND hwnd = HtmlHelp(GetDesktopWindow()->m_hWnd ,szHelpFile,HH_DISPLAY_TOPIC,NULL) ; 有关HtmlHelp()的更多信息请参考MSDN中的HTMLHelp API Reference主题。
      

  3.   

    MSDN光盘中有一个SCRIBBLE例子,其中step6就是讲这个问题的,即上下文关联帮助