让程序出现windows标准对话框式样的帮助
点击次数:56 次 发布日期:2008-11-09 08:39:12 作者:源代码网
|
源代码网推荐 interface 源代码网推荐 源代码网推荐 uses 源代码网推荐 Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, 源代码网推荐 StdCtrls; 源代码网推荐 源代码网推荐 const 源代码网推荐 HH_DISPLAY_TOC = $0001; 源代码网推荐 HH_DISPLAY_TOPIC = $0000; 源代码网推荐 HH_CLOSE_ALL = $0012; 源代码网推荐 HH_DISPLAY_INDEX = $0002; 源代码网推荐 HH_HELP_CONTEXT = $000F; 源代码网推荐 HH_DISPLAY_SEARCH= $0003; 源代码网推荐 HH_DISPLAY_TEXT_POPUP = $000E; 源代码网推荐 源代码网推荐 type 源代码网推荐 HH_FTS_Query = record 源代码网推荐 cbStruct : integer; // sizeof structure 源代码网推荐 fUniCodeStrings : bool; // true if all strings are unicode 源代码网推荐 pszSearchQuery : PChar; // string with the search query 源代码网推荐 iProximity : longint; // word proximity 源代码网推荐 fStemmedSearch : bool; // true for stemmed search only 源代码网推荐 fTitleOnly : bool; // true for title search only 源代码网推荐 fExecute : bool; // true to initiate the search 源代码网推荐 pszWindow : PChar; // window to display in 源代码网推荐 end; // HH_FTS_Query 源代码网推荐 源代码网推荐 HH_POPUP = record 源代码网推荐 cbStruct: integer; // sizeof this structure 源代码网推荐 hinst: longint; // instance handle for string resource 源代码网推荐 idString: UINT; // string resource id, or text id if pszFile is specified in HtmlHelp call 源代码网推荐 pszText: LPCTSTR; // used if idString is zero 源代码网推荐 pt: TPOINT; // top center of popup window 源代码网推荐 clrForeground: COLORREF; // use -1 for default 源代码网推荐 clrBackground: COLORREF; // use -1 for default 源代码网推荐 rcMargins: TRECT; // amount of space between edges of window and text, -1 for each member to ignore 源代码网推荐 pszFont: LPCTSTR; // facename, point size, char set, BOLD ITALIC UNDERLINE 源代码网推荐 end; 源代码网推荐 源代码网推荐 源代码网推荐 type 源代码网推荐 TForm1 = class(TForm) 源代码网推荐 Button1: TButton; 源代码网推荐 Button2: TButton; 源代码网推荐 Button3: TButton; 源代码网推荐 Button4: TButton; 源代码网推荐 Button5: TButton; 源代码网推荐 源代码网推荐 procedure Button1Click(Sender: TObject); 源代码网推荐 procedure Button2Click(Sender: TObject); 源代码网推荐 procedure Button3Click(Sender: TObject); 源代码网推荐 procedure Button4Click(Sender: TObject); 源代码网推荐 procedure Button5Click(Sender: TObject); 源代码网推荐 private 源代码网推荐 { Private declarations } 源代码网推荐 public 源代码网推荐 { Public declarations } 源代码网推荐 end; 源代码网推荐 源代码网推荐 var 源代码网推荐 Form1: TForm1; 源代码网推荐 源代码网推荐 implementation 源代码网推荐 源代码网推荐 {$R *.DFM} 源代码网推荐 源代码网推荐 function HtmlHelp(hwndCaller: HWND; pszFile: PChar; uCommand: UINT; 源代码网推荐 dwData: PDWORD): HWND; stdcall; external "hhctrl.ocx" Name "HtmlHelpA"; 源代码网推荐 源代码网推荐 procedure TForm1.Button1Click(Sender: TObject); 源代码网推荐 begin 源代码网推荐 { 源代码网推荐 调用缺省主题帮助 源代码网推荐 此调用方式用于没有上下文ID号的情形,dwData可指定一个在CHM文件内的缺省htm文件, 源代码网推荐 也可取Nil,这是HtmlHelp API最基本的一种用法。 源代码网推荐 } 源代码网推荐 HtmlHelp(handle,pchar("help.chm"),HH_DISPLAY_TOPIC,PDWORD(pchar("article.htm"))); 源代码网推荐 //或:HtmlHelp(handle,pchar("help.chm"),HH_DISPLAY_TOPIC,nil); 源代码网推荐 end; 源代码网推荐 源代码网推荐 procedure TForm1.Button2Click(Sender: TObject); 源代码网推荐 begin 源代码网推荐 { 源代码网推荐 调用关键字帮助 源代码网推荐 此调用方式中dwData取索引文件(.hhk)中存在的关键字。 源代码网推荐 } 源代码网推荐 HtmlHelp(handle,pchar("help.chm"),HH_DISPLAY_INDEX,PDWORD(pchar("ambaSio"))); 源代码网推荐 end; 源代码网推荐 源代码网推荐 procedure TForm1.Button3Click(Sender: TObject); 源代码网推荐 var 源代码网推荐 dw: DWORD; 源代码网推荐 begin 源代码网推荐 { 源代码网推荐 调用上下文敏感帮助 源代码网推荐 此调用方式用于含有映射信息的CHM文件, dwData取映射表中存在的ID号。 源代码网推荐 } 源代码网推荐 dw := 10; 源代码网推荐 HtmlHelp(handle,pchar(">help.chm"),HH_HELP_CONTEXT,PDWORD(@dw)); 源代码网推荐 //这种方式我没试出来,可能是我的chm文件不含映射信息的缘故。 源代码网推荐 end; 源代码网推荐 源代码网推荐 procedure TForm1.Button4Click(Sender: TObject); 源代码网推荐 var 源代码网推荐 query: HH_FTS_Query; 源代码网推荐 begin 源代码网推荐 { 源代码网推荐 调用全文搜索帮助 源代码网推荐 } 源代码网推荐 with query do 源代码网推荐 begin 源代码网推荐 cbStruct := sizeof(HH_FTS_Query); 源代码网推荐 fUniCodeStrings := false; 源代码网推荐 iProximity := 1; 源代码网推荐 fStemmedSearch := true; 源代码网推荐 fExecute := true; 源代码网推荐 fTitleOnly := false; 源代码网推荐 pszWindow := "MainWin"; 源代码网推荐 pszSearchQuery := nil; 源代码网推荐 end; 源代码网推荐 HtmlHelp(handle,pchar("help.chm"),HH_DISPLAY_SEARCH,PDWORD(@query)); 源代码网推荐 end; 源代码网推荐 源代码网推荐 procedure TForm1.Button5Click(Sender: TObject); 源代码网推荐 var 源代码网推荐 popup: HH_POPUP; 源代码网推荐 begin 源代码网推荐 { 源代码网推荐 调用弹出式帮助 源代码网推荐 PszFile通常取NULL,也可以指定一个CHM和一个在该CHM文件中的TEXT文件,DwData用 源代码网推荐 于指定一个指向HH_POPUP结构的指针。 源代码网推荐 } 源代码网推荐 with popup do 源代码网推荐 begin 源代码网推荐 cbStruct := sizeof(HH_POPUP); 源代码网推荐 hinst:= 0; 源代码网推荐 idString:=1; 源代码网推荐 pszText:=nil; 源代码网推荐 //pt:= pt; 源代码网推荐 GetCursorPos(pt); 源代码网推荐 clrForeground:=COLORREF(-1); 源代码网推荐 clrBackground:=COLORREF(-1); 源代码网推荐 rcMargins.Left := 0; 源代码网推荐 rcMargins.Top := 0; 源代码网推荐 rcMargins.Right := 25; 源代码网推荐 rcMargins.Bottom := 25; 源代码网推荐 pszFont:=LPCTSTR("BOLD"); 源代码网推荐 end; 源代码网推荐 HtmlHelp(handle,pchar("test.chm"),HH_DISPLAY_TEXT_POPUP,PDWORD(@popup)); 源代码网推荐 end; 源代码网推荐 源代码网推荐 end. 源代码网推荐 源代码网供稿. |
