怎么我用
uses shellapi
...
...
shellexecute(handle,'open',nil,'SMS.chm',nil,nil,SW_SHOWNORMAL);老是提示:
[Error] Unit1.pas(28): Incompatible types: 'Integer' and 'Pointer'
[Fatal Error] Project1.dpr(5): Could not compile used unit 'Unit1.pas'谢谢!!~~~~
uses shellapi
...
...
shellexecute(handle,'open',nil,'SMS.chm',nil,nil,SW_SHOWNORMAL);老是提示:
[Error] Unit1.pas(28): Incompatible types: 'Integer' and 'Pointer'
[Fatal Error] Project1.dpr(5): Could not compile used unit 'Unit1.pas'谢谢!!~~~~
procedure TForm1.OpenCHM;
var
p:pchar;
begin
if FileExists(Trim(ExtractFilePath(Application.ExeName))+'acdata.chm') then
begin
p:=pchar(Trim(ExtractFilePath(Application.ExeName))+'acdata.chm');
ShellExecute(0, nil, p, nil, nil, SW_NORMAL);
end
else
begin
MessageBox(Form1.Handle,'没有帮助文件!','提示', MB_OK or MB_ICONINFORMATION);
end;
end;
在你的CHM的页面中按右键,选择属性,可看到该页的地址:
假设看到的地址是
mk:@MSITStore:D:\系统帮助.CHM::/systemdata-1-4.htm而这个地址对应着你程序的某个窗口,那么在那个窗口的OnKeyDown事件中if Key = VK_F1 then
WinExec(pchar('hh.exe mk:@MSITStore:'+ExtractFilePath(Application.Exename)+'系统帮助.CHM::/systemdata-1-4.htm'), SW_SHOW);