这个方法可多了,我是这样调用的。
var
hHelpFile,hDir : string;
hSysDir : array [0..255] of char;
begin
hHelpFile := ExtractFileDir (Application.ExeName);
hHelpFile := Concat (hHelpFile,'\','aaa.hlp');
if FileExists (hHelpFile) then
begin
GetWindowsDirectory (hSysDir,255);
hDir := Concat (hSysDir,'\winhlp32.exe');
WinExec (PChar (hDir + ' ' + hHelpFile),SW_SHOW);
end;
我的帮助文件在可执行程序的相同目录,
1,得到完整的帮助文件的绝对路径,加上帮助文件名
2,得到windows的系统目录,然后用在目录下的winhlp32.exe运行。
var
hHelpFile,hDir : string;
hSysDir : array [0..255] of char;
begin
hHelpFile := ExtractFileDir (Application.ExeName);
hHelpFile := Concat (hHelpFile,'\','aaa.hlp');
if FileExists (hHelpFile) then
begin
GetWindowsDirectory (hSysDir,255);
hDir := Concat (hSysDir,'\winhlp32.exe');
WinExec (PChar (hDir + ' ' + hHelpFile),SW_SHOW);
end;
我的帮助文件在可执行程序的相同目录,
1,得到完整的帮助文件的绝对路径,加上帮助文件名
2,得到windows的系统目录,然后用在目录下的winhlp32.exe运行。
var
p:pchar;
begin
if FileExists(ExtractFilePath(Application.Exename)+'Readme.chm') then
begin
p:=pchar(ExtractFilePath(Application.Exename)+'Readme.chm');
ShellExecute(0, 'open', p, nil, nil, SW_SHOWNORMAL);
end
else
showmessage("帮助文件丢失!");
end;
end.