请问怎样在delphi中调用chm帮助文件?

解决方案 »

  1.   

    ShellExecute(Handle, 'open', PChar('c:\test\123.chm'),nil, nil, SW_SHOW);
      

  2.   

    ShellExecute    API函数在ShellAPI单元中,不过这只是运行chm文件而于。
      

  3.   

    procedure TfrmMain.mnAboutTopicClick(Sender: TObject);
    var
      hHelpFile,hDir : string;
      hSysDir : array [0..255] of char;
    begin
      hHelpFile := ExtractFileDir (Application.ExeName);
      hHelpFile := Concat (hHelpFile,'\','hh.exe');
      if FileExists (hHelpFile) then
      begin
        GetWindowsDirectory (hSysDir,255);
        hDir := Concat (hSysDir,SYS_HELP_FILE);
        if not FileExists (hDir) then
          Application.MessageBox (PChar ('无法找到帮助文件,请重新安装程序'),
                                  PChar (THINT),
                                  MB_OK + MB_ICONASTERISK);
        WinExec (PChar (hDir + ' ' + hHelpFile),SW_SHOW);
      end
      else
        Application.MessageBox (PChar ('无法找到帮助文件,请重新安装程序'),
                                PChar (THINT),
                                MB_OK + MB_ICONASTERISK);
    end;