Delphi应用程序与Chm帮助关联的简单实现(源代码) (转)

Delphi应用程序与Chm帮助关联的简单实现(源代码) (转)[@more@]

Delphi应用程序与Chm帮助关联的简单实现(源代码)

请参考:Delphi程序与Chm帮助关联的简单实现
.NET/Develop/Article/18/18116.shtm">http://www.csdn.net/Develop/Article/18/18116.shtm 

2003-6-71925030.jpg" align=baseline border=0>

unit Unit1;
///  作者:李新  Mailto:kelvinsdu@sina.com" rel="nofollow">kelvinsdu@sina.com  qq:1348513
interface

uses
  windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  ComCtrls, StdCtrls;
const
  conHelpTitle='科研项目管理系统 2.0';
  HH_DISPLAY_TOPIC=0;//先查msdn,有好多command,自己改成0,1之类的
type
  TForm1 = class(TForm)
  EdtProjectManager: TEdit; // helpcontext =10101
  Button1: TButton;
  Label1: TLabel;
  EdtFinanceInput: TEdit; // helpcontext =10102
  function FormHelp(Command: word; Data: Integer;
  var CallHelp: Boolean): Boolean;
  procedure Button1Click(Sender: Tobject);
  private
  { Private declarations }
  public
  { Public declarations }
  end;
  procedure ShowChmHelp(sTopic:string);
var
  Form1: TForm1;
  function HtmlHelpA (hwndcaller:Longint; lpHelpFile:string; wCommand:Longint;dwData:string): HWND;stdcall; external 'hhctrl.ocx'

implementation
uses Unit2;
{$R *.DFM}
Function  CurrentExeFilepath:String; //返回当前的路径
var cdir:string;
Begin
  Result:='';
  SetLength(CDir,144);
  If GetCurrentDirectory(144,PChar(CDir))<>0 Then
  SetLength(CDir,StrLen(PChar(CDir)))
  Else
  RaiseLastwin32Error;
  Result:=CDir;
End;
procedure ShowChmHelp(sTopic:string);
var i:integer;
begin
  i:=HtmlHelpA(Application.Handle,Pchar(CurrentExeFilepath+'help.chm'),HH_DISPLAY_TOPIC,sTopic);
  if i=0 then
  begin
  Showmessage(' help.chm 帮助文件损坏!');
  exit;
  end;
end;

function TForm1.FormHelp(Command: Word; Data: Integer;
  var CallHelp: Boolean): Boolean;
begin
  case Data of
  10100: ShowChmHelp('SysteRmintroduction.htm');
  10101: ShowChmHelp('ProjectManager.htm');
  10102: ShowChmHelp('FinanceInput.htm');
  else  ShowChmHelp('SystermIntroduction.htm');
  end;

end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  OKBottomDlg:=TOKBottomDlg.create(nil);
  try
  OKBottomDlg.ShowModal;
  finally
  OKBottomDlg.free;
  end;
end;

end.

/

 

unit Unit2;

interface

uses Windows, SysUtils, Classes, Graphics, Forms, Controls, StdCtrls,
  Buttons, ExtCtrls;

type
  TOKBottomDlg = class(TForm)
  OKBtn: TButton;
  CancelBtn: TButton;
  cbQuickQuery: TComboBox; // helpcontext =10200
  EdtSuperQuery: TEdit;  // helpcontext =10201
  function FormHelp(Command: Word; Data: Integer;
  var CallHelp: Boolean): Boolean;
  private
  { Private declarations }
  public
  { Public declarations }
  end;

var
  OKBottomDlg: TOKBottomDlg;

implementation
uses unit1;
{$R *.DFM}

function TOKBottomDlg.FormHelp(Command: Word; Data: Integer;
  var CallHelp: Boolean): Boolean;
begin
  case Data of
  10200: ShowChmHelp('QuickQuery.htm');
  10201: ShowChmHelp('SuperQuery.htm');
  else  ShowChmHelp('SystermIntroduction.htm');
  end;
end;

en


来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/10752019/viewspace-958766/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/10752019/viewspace-958766/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值