用ShellExecute函数,
不过没法关联上下文了。

解决方案 »

  1.   

    在Delphi5中使用HTML HELP帮助Delphi5并不支持HTML HELP帮助系统,它仍然使用WinHelp。笔者通过反复尝试,发现调用Windows系统目录System32下的HHCTRL.OCX,利用其中的HtmlHelpA函数接口可以自行实现HTML HELP帮助。公共模块代码如下:unit HTMLHELPCOMMONinterfaceuses Windows;typeDWORD_PTR = ^DWORD;FunctionHtmlHelp(hwndCaller:HWND;strFile:String;uCommand:UINT; dwData:DWORD_PTR ):HWND;procedure CloseHtmlHelp;implementationusesSysUtils;constHHControlInstance:THandle=0;dwCookie :DWORD = 0;varHtmlHelpA:function ( hwndCaller:HWND; pszFile:PChar ;uCommand:UINT; dwData:DWORD_PTR ):HWND;stdcall;function HtmlHelp(hwndCaller:HWND;strFile:String;uCommand:UINT; dwData:DWORD_PTR ):HWND;varLFileName:String;p:PChar;beginif HHControlInstance=0 thenbeginLFileName := StringOfChar( ' ', 256);p := PChar( LFilename );GetSystemDirectory(p,255);StrCat(p,'.OCX');HHControlInstance := LoadLibrary( P );if HHControlInstance = 0 thenraise exception.Create('Help system not installed!'#13' HTMLHELP cannot displayed!');@HtmlHelpA := GetProcAddress( HHControlInstance, 'HtmlHelpA');if @HtmlHelpA = nil thenraise exception.Create('Function HTMLHELP cannot loaded!');HtmlHelpA( 0, nil,$001C , (@dwCookie));end;result := HtmlHelpA( hwndCaller, PChar( strFile ), uCommand, dwData );end;procedure CloseHtmlHelp;beginif HHControlInstance<>0 thenbeginHtmlHelpA( 0, nil, $001D, DWORD_PTR(dwCookie));FreeLibrary(HHControlInstance);end;end;end.两个函数分别初始化和释放调用接口。其它模块只须按约定调用即可。例如:HtmlHelp( handle, htmlhelpfilename+'::/welcome.htm',$0000, nil);显示htmlhelpfilename对应的帮助文件的welcome页面。上下文敏感帮助需要借用Delphi对WinHelp的支持。当用户按 F1 键时,程序将自动触发OnHelp事件,截获它,编写自己的处理代码即可。... ...Application.HelpFile := htmlhelpfilename;tmpOnHelp := Application.OnHelp;Application.OnHelp := AppHtmlHelp;... ...function TForm1.AppHtmlHelp(Command: Word; Data: Longint;var CallHelp: Boolean): Boolean;var ret:integer;Hfile:string;beginif not CallHelp then exit;AppPath := ExtractFilePath(Application.ExeName);Hfile := AppPath + Application.HelpFile;case Command ofHELP_FINDER, HELP_CONTENTS:ret := HtmlHelp(handle, pchar(Hfile), $0001, nil);HELP_QUIT:ret := HtmlHelp(0, '', $0012, nil);HELP_CONTEXT:ret := HtmlHelp(handle, pchar(Hfile), $000f, DWORD_PTR(data));end;result:=ret<>0;CallHelp := False;end;这样,我们就有另一种方法调用帮助文件,与传统WinHelp调用方法一样:application.helpcommand(HELP_FINDER, 0);application.helpcommand(HELP_quit, 0);... ...以上代码用Delphi5企业版开发,在大型应用中运行良好。抛砖引玉,与大家共享。
      

  2.   

    尽管本贴已经结贴,还是要提醒后来者, xpmao() 法中Application.OnHelp在Delphi6中无法使用,是Delphi6的Bug,害了我大半天才确定。
      

  3.   

    详情请参见http://www.helpware.net/downloads/