我在应用程序中做了一个帮助文件,是chm格式的。请问在DELPHI中如何调用他.(100分)

  • 主题发起人 tianxing78
  • 开始时间
T

tianxing78

Unregistered / Unconfirmed
GUEST, unregistred user!
我在应用程序中做了一个帮助文件,是chm格式的。请问在DELPHI中如何调用他。网友告诉我用Application.HelpFile := 'page/file'
Application.HelpCommand(HELP_INDEX,0);
这样是不行的,请问该怎么办?
 
老问题:
uses shellapi;
ShellExecute(0,'open','C:/netants/NetAnts.chm',nil,nil,SW_SHOWNORMAL);
 

HTMLHelp API Reference
The HtmlHelp API currently resides in the file HTMLHELP.DLL, however this is very likely to be moved to a different DLL before HTML Help ships. If you are not using GetProcAddress to get a pointer to the HtmlHelp function, then you must plan on changing the library you link to.

The functionality provided by the HtmlHelp API resides in the file HHCTRL.OCX. Because this functionality requires loading various other DLLs such as ole32.dll, the API itself resides in a DLL that requires no additional DLLs to be loaded. Only when the API is actually called will ole32 and other DLLs be loaded.

The HtmlHelp API is modeled after the WinHelp API function to make it easy to convert existing programs to use HTML Help instead of WinHelp to display their help. By the time HTML Help ships, there will also be an IHHWindow interface that can be used in place of the HtmlHelp API. This can be used by programs that already load OLE32.DLL or by programs like Visual Basic.

In its simplest form, the HtmlHelp API creates a child window which in turn hosts SHDOCVW and displays the HTML file you specify. The window is a child of whatever parent window you specify, and will automatically stay on top of that parent window, and close when the parent window is closed. You can also take complete control of the window-creation process by defining the window styles, coordinates, caption, and display state. This means you can embed SHDOCVW even in a non-OLE activated program.

SYNTAX

HWND HtmlHelp(HWND hwndCaller, LPCSTR pszFile, UINT uCommand, DWORD dwData);

hwndCaller
Specifies the handle of the window calling the HtmlHelp API. If the HtmlHelp API call results in messages being sent from the HTML Help window, they will be sent to this window handle.
pszFile
Specifies an HTML file, a URL, a compiled HTML file, or a window definition (preceeded with a ‘>’ character). If the command being used does not require a file or URL, this value may be NULL.
uCommand
Specifies the action to perform. See the Comments section for details.
dwData
Specifies any data that may be required based on the value of the uCommand parameter.
Comments

太长了,自己查msdn帮助吧
在delphi中的函数定义
Function HtmlHelpA(hwnd:integer;lpHelpFile:string;wCommand:integer;dwData:string) :integer;stdcall;External 'hhctrl.ocx';
wCommand要自己查msdn中需要的参数,然后换成0、1这些
使用参数
Command Description pszFile dwData
HH_DISPLAY_TOPIC Displays an HTML file. If a window type is not specified, a default window type is used. If the window type or default window type is already being displayed, the HTML file will replace what is currently being displayed. File, URL, or compiled HTML file. If the greater then character (>) is used, it must be followed by the name of the window type to display the topic in. May be zero or a pointer to a File, URL, or compiled HTML file. This parameter may be a pointer to a filename within a compiled HTML file if the pszFile parameter points to that compiled HTML file.

HtmlHelpA(Handle,'c:/htmlhelp2/rshelp.chm',0,'欢迎.htm');



 
无疯无禄大哥,没这么复杂吧。,
 
声明:
'hhctrl.ocx'为系统自带的控件
function HtmlHelpA (hwndcaller:Longint;lpHelpFile:string;wCommand:Longint;dwData:string):HWND;stdcall;external 'hhctrl.ocx'
const
HH_DISPLAY_TOPIC=0;

调用:
可以定位到某一html页面,例中调用jxc.chm的xsddzd.htm页面,要指定该页面(编译时的)的相对路径
procedure TfrmSALEORDER.FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
var
p:pchar;
begin
if key=VK_F1 then
begin
if FileExists(ExtractFilePath(Application.Exename)+'jxc.chm') then
begin
p:=pchar(ExtractFilePath(Application.Exename)+'jxc.chm');
end;
htmlhelpA(handle,p,HH_DISPLAY_TOPIC,'xsgl/xsddzd.htm');
end;
end;
 
你全文搜索一下,有很多相关的帖子,太多了。
查关键字“chm”就可以
 
有一个控件htmlhelp很容易实现
么的话留下mail
 
cb_hfxy:
真正实现联机帮助只有这样。你有什么好办法呢
 
一个函数就搞定了:Winexec
用法自己看帮助。
 
我是这样用的:
winexec('hh help.chm',SW_SHOWDEFAULT );
 
顶部