添加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:
0APublic Const HH_HELP_CONTEXT 3D &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:0D
Public Declare Function HtmlHelpLongArg Lib "hhctrl.ocx" _0D
Alias "HtmlHelpA" (ByVal hwndCaller As Long, _
ByVal pszFile As String, ByVal uCommand As Long, _
ByVal dwData As Long) As Long0D
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)0D
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 subPrivate Sub MeuHelpFile_Click() '帮助主题-菜单
Dim Hlp As Long
Hlp = WinHelp(MainForm.hwnd, App.HelpFile, HELP_FINDER, CLng(0))0D
End Sub
以上代码来自: SourceCode Explorer(源代码数据库)
复制时间: 2002-05-27 16:30:40
当前版本: 1.0.690
作者: Shawls
个人主页: Http://Shawls.Yeah.Net
E-Mail: [email protected]
QQ: 9181729
我是小山,我喜欢VB,现在在学习C#和.net的相关知识
欢迎您使用: SourceCode Explorer(源代码数据库)
当前版本: 1.0.690
作者: Shawls
来自: Http://www.dapha.net
个人主页: Http://Shawls.Yeah.Net
E-Mail: [email protected]
form.
Add a module to the project, and add the following constants to the declarat
ion section of the module:
0APublic Const HH_HELP_CONTEXT 3D &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:0D
Public Declare Function HtmlHelpLongArg Lib "hhctrl.ocx" _0D
Alias "HtmlHelpA" (ByVal hwndCaller As Long, _
ByVal pszFile As String, ByVal uCommand As Long, _
ByVal dwData As Long) As Long0D
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)0D
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 subPrivate Sub MeuHelpFile_Click() '帮助主题-菜单
Dim Hlp As Long
Hlp = WinHelp(MainForm.hwnd, App.HelpFile, HELP_FINDER, CLng(0))0D
End Sub
以上代码来自: SourceCode Explorer(源代码数据库)
复制时间: 2002-05-27 16:30:40
当前版本: 1.0.690
作者: Shawls
个人主页: Http://Shawls.Yeah.Net
E-Mail: [email protected]
QQ: 9181729
我是小山,我喜欢VB,现在在学习C#和.net的相关知识
欢迎您使用: SourceCode Explorer(源代码数据库)
当前版本: 1.0.690
作者: Shawls
来自: Http://www.dapha.net
个人主页: Http://Shawls.Yeah.Net
E-Mail: [email protected]
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货