急急急,!!这样在VB中调用CHM格式的帮助文件!!???help me!
我想在VB程序中调用一个CHM格式的帮助文件,但是用SHELL语句根本不行,能不能告诉我,我该什么做啊!???谢谢!! 问题点数:50、回复次数:5Top
1 楼mornwoo(爱永恒伤离别)回复于 2002-06-21 11:33:06 得分 0
用shell 函数执行hh.exe 打开 chm文件
例如: shell "c:\windows\hh.exe c:\aaa.chm"
hh.exe 是windows系统文件,在windows根目录下,一般是c:\windows(加入windows装在此目录下的话)Top
2 楼sanjianxia(三剑侠)回复于 2002-06-21 11:34:04 得分 0
采用api函数shellexe()
Top
3 楼shawls(VB Fan)(QQ:9181729)回复于 2002-06-21 11:34:07 得分 10
添加HtmlHelp到工程
Create a new project, Form1 is created by default. Add a few controls to the
form.
Add a module to the project, and add the following constants to the declarat
ion section of the module:
Public Const HH_HELP_CONTEXT = &HF
Public Const MYHELP_FILE = "myfile.chm"
NOTE: "myfile.chm" is the path and name of the HTML Help file (.ch
m) you created earlier.
Add the following HTML Help API declaration to the module:
Public Declare Function HtmlHelpLongArg Lib "hhctrl.ocx" _
Alias "HtmlHelpA" (ByVal hwndCaller As Long, _
ByVal pszFile As String, ByVal uCommand As Long, _
ByVal dwData As Long) As Long
Intercept the form's KeyUp method to capture the F1 key using the following
sample code in the Form KeyUp event procedure:
Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)
dim iRetCode As Long
If KeyCode = vbKeyF1 Then
iRetCode = HtmlHelpLongArg(Me.ActiveControl.hWnd,_
MYHELP_FILE,HH_HELP_CONTEXT,Me.ActiveControl.HelpContextID)
End If
End Sub
Set the form's KeyPreview, WhatsThisHelp, and WhatsThisButton properties to
TRUE.
Set the HelpContextID property of each control on the form to a value from t
he help project file's MAP section.
方法二:
Public Declare Function WinHelp Lib "user32" Alias "WinHelpA" (ByVal hwnd As Long, ByVal lpHelpFile As String, ByVal wCommand As Long, ByVal dwData As Long) As Long
Public Const HELP_FINDER = &HB&
Private Sub Form_Load() '主窗体载入
App.HelpFile = App.Path & "\help\*.HLP" '帮助文件
end sub
Private Sub MeuHelpFile_Click() '帮助主题-菜单
Dim Hlp As Long
Hlp = WinHelp(MainForm.hwnd, App.HelpFile, HELP_FINDER, CLng(0))
End Sub
以上代码来自: SourceCode Explorer(源代码数据库)
复制时间: 2002-06-21 11:31:04
当前版本: 1.0.710
作者: Shawls
个人主页: Http://Shawls.Yeah.Net
E-Mail: ShawFile@163.Net
QQ: 9181729Top
4 楼sanjianxia(三剑侠)回复于 2002-06-21 11:35:48 得分 40
采用以下代码,调用, 以下是我程序中的调用gggl.chm文件。
ShellExecute 0&, vbNullString, App.Path & "\help\gggl.chm",
vbNullString, vbNullString, vbNormalFocusTop
5 楼blkant()回复于 2002-06-21 11:50:29 得分 0
用shell函数可以实现。Top




