如何调用.chm帮助文件(50分)

  • 主题发起人 主题发起人 myjsy1163
  • 开始时间 开始时间
M

myjsy1163

Unregistered / Unconfirmed
GUEST, unregistred user!
我用Microsoft HTML Help Shop 编写了一个.chm帮助文件,<br>想在Delphi下 "帮助菜单|内容" 调用,我用WinHelp函数调用,但提示说<br>此.chm帮助文件找不到,但我机器上确实有此文件,不知如何解决此问题<br>请高手请教,谢谢
 
加入shellapi单元<br>调用shellexecute函数<br>例如 ShellExecute(application.handle,'open','c:/myhelp/help.chm','','',sw_show)<br>如果要指定调用某一页,参见<br>http://www.delphibbs.com/delphibbs/dispq.asp?lid=740358<br>
 
unit Unit1;<br><br>interface<br><br>uses<br>&nbsp; Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,<br>&nbsp; Dialogs, StdCtrls,shellapi;<br><br>type<br>&nbsp; TForm1 = class(TForm)<br>&nbsp; &nbsp; Button1: TButton;<br>&nbsp; &nbsp; Button2: TButton;<br>&nbsp; &nbsp; procedure Button1Click(Sender: TObject);<br>&nbsp; &nbsp; procedure Button2Click(Sender: TObject);<br>&nbsp; private<br>&nbsp; &nbsp; { Private declarations }<br>&nbsp; public<br>&nbsp; &nbsp; { Public declarations }<br>&nbsp; end;<br><br>var<br>&nbsp; Form1: TForm1;<br><br>implementation<br>function &nbsp;HtmlHelpA(Handle:HWND;lpHelpFile:string;wCommand:integer;dwData:string):Integer;stdcall;External 'hhctrl.ocx';<br>{$R *.dfm}<br><br>procedure TForm1.Button1Click(Sender: TObject);<br>begin<br>&nbsp; ShellExecute(handle, 'open', 'KIme.chm',nil,nil, SW_SHOWMAXIMIZED);<br>end;<br><br>procedure TForm1.Button2Click(Sender: TObject);<br>begin<br>HtmlhelpA(form1.handle,'KIme.chm',0,'');<br>end;<br><br>end.<br>
 
uses<br>&nbsp;shellapi;<br>winexec(pchar('d:/windows/hh.exe '+ hlpfilename),sw_show);
 
application.help ;= 'myhelp.chm'
 
var path:string;<br>begin<br>&nbsp; &nbsp; &nbsp;try<br>&nbsp; &nbsp; &nbsp;path:=extractfilepath(application.ExeName)+'/系统帮助.chm';<br>&nbsp; &nbsp; &nbsp;ShellExecute(Handle, 'open', pchar(path), nil, nil, SW_SHOW);<br>&nbsp; &nbsp; &nbsp;except<br>&nbsp; &nbsp; &nbsp;end;<br><br>end;
 
有这么多的方法呀,还是shellexecute好用,常用
 
后退
顶部