MSDN中VB的例子,我想翻译成Delphi应该比较容易。
Declare Function HtmlHelp Lib "HHCtrl.ocx" Alias "HtmlHelpA" _
(ByVal hwndCaller As Long, _
ByVal pszFile As String, _
ByVal uCommand As Long, _
dwData As Any) As LongCall HtmlHelp(0, "c:\help\Sample.chm", HH_DISPLAY_TOPIC, By Val "Topic1.htm")Call HtmlHelp(0, "c:\help\Sample.chm>mso_small", HH_DISPLAY_TOPIC, By Val 2001&)
Declare Function HtmlHelp Lib "HHCtrl.ocx" Alias "HtmlHelpA" _
(ByVal hwndCaller As Long, _
ByVal pszFile As String, _
ByVal uCommand As Long, _
dwData As Any) As LongCall HtmlHelp(0, "c:\help\Sample.chm", HH_DISPLAY_TOPIC, By Val "Topic1.htm")Call HtmlHelp(0, "c:\help\Sample.chm>mso_small", HH_DISPLAY_TOPIC, By Val 2001&)
interface
uses
Windows, Messages, shellapi,SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;
type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
procedure MyProcedure(var Msg: TMsg; var Handled: Boolean);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.MyProcedure(var Msg: TMsg; var Handled: Boolean);
var
FileName:Pchar;
begin
FileName:=Your.chm;//你的帮助文件*.chm的路径
if msg.message=WM_KEYDOWN then
if msg.wParam=$70 then
ShellExecute(0, 'open', FileName, nil, nil, SW_SHOW);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
application.OnMessage:=MyProcedure;
end;end.
to chechy(我爱洁洁) 有没有简单一点的方法??
ftp://delphi-jedi.org/api/HtmlHelp.zipSample Code:
procedure ShowHelp(Pt: TPoint; ContextId: Integer);
var
Popup: THHPopup;
begin
// We only know about helpcontext 1 to 24
if (ContextId >= 1) and (ContextId <= 24) then
begin
FillChar(Popup, SizeOf(Popup), 0);
Popup.cbStruct := SizeOf(Popup);
Popup.hinst := 0;
Popup.idString := 0;
Popup.pszText := PChar(HelpStrings[ContextId]);
Popup.pt := Pt;
Popup.clrForeGround := TColorRef(-1);
Popup.clrBackground := TColorRef(-1);
Popup.rcMargins := Rect(-1, -1, -1, -1);
Popup.pszFont := '';
HtmlHelp(0, nil, HH_DISPLAY_TEXT_POPUP, DWORD(@Popup));
end;
end;
出错的代码行:HHControlInstance := LoadLibrary( P );
[Error] HTMLHELP_Decl.pas(443): Left side cannot be assigned to
是不是delphi6下不能用啊???