也许很简单!!!

gaiwa 2000-08-14 03:35:00
我在command1_Click 下用了以下代码
App.HelpFile = "C:\Program Files\Microsoft Visual Studio\VB98\Sccvbus.chm"
这样按F1就可以打开Sccvbus.chm文件,但我想用Click事件直接打开Sccvbus.chm文件
而不需要去按F1,请问这样的代码该怎样写?谢谢!!
...全文
111 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
prefix 2000-08-14
  • 打赏
  • 举报
回复
直接 SendKeys "{F1}"就行了。没问题的。
playyuer 2000-08-14
  • 打赏
  • 举报
回复
The steps needed to use the HTML Help API in a Visual Basic application are:



Declare the HTML Help constants.


Declare the HtmlHelp() function.


Call the HtmlHelp() function with valid parameters.


The following code fragments demonstrate these steps:


The HTML Help constants are defined as follows:
Const HH_DISPLAY_TOPIC = &H0
Const HH_SET_WIN_TYPE = &H4
Const HH_GET_WIN_TYPE = &H5
Const HH_GET_WIN_HANDLE = &H6
Const HH_DISPLAY_TEXT_POPUP = &HE ' Display string resource ID or
' text in a pop-up window.
Const HH_HELP_CONTEXT = &HF ' Display mapped numeric value in
' dwData.
Const HH_TP_HELP_CONTEXTMENU = &H10 ' Text pop-up help, similar to
' WinHelp's HELP_CONTEXTMENU.
Const HH_TP_HELP_WM_HELP = &H11 ' text pop-up help, similar to
' WinHelp's HELP_WM_HELP.



The HtmlHelp() function is declared as follows:
Declare Function HtmlHelp Lib "hhctrl.ocx" Alias "HtmlHelpA" _
(ByVal hwndCaller As Long, ByVal pszFile As String, _
ByVal uCommand As Long, ByVal dwData As Long) As Long



The following are examples of how to call the HTML Help API from Visual Basic:
' HTML Help file launched in response to a button click:
Private Sub HH_DISPLAY_Click()
'hWnd is a Long defined elsewhere to be the window handle
'that will be the parent to the help window.
Dim hwndHelp As Long
'The return value is the window handle of the created help window.
hwndHelp = HtmlHelp(hWnd, "myfile.chm", HH_DISPLAY_TOPIC, 0)
End Sub

' A specific topic identified by the variable ContextID is launched
' in response to this button click:
Private Sub HH_HELP_Click()
Dim hwndHelp As Long
'The return value is the window handle of the created help window.
hwndHelp = HtmlHelp(hWnd, "myfile.chm", HH_HELP_CONTEXT, ContextID)
End Sub
Un1 2000-08-14
  • 打赏
  • 举报
回复
Public Sub HelpContent()

Dim s As String
s = App.HelpFile
If Len(Dir$(s)) <= 0 Then Err.Raise 53 + 512, , "文件未找到 " & s

DoEvents

SendKeys "{F1}"
End Sub

huntout 2000-08-14
  • 打赏
  • 举报
回复
Public Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _
(ByVal hwnd As Long, ByVal lpOperation As String, _
ByVal lpFile As String, ByVal lpParameters As String, _
ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

'in command1_Click
ShellExecute Me.hwnd, vbNullString, "C:\Program Files\Microsoft Visual Studio\VB98\Sccvbus.chm", vbNullString, vbNullString, 0&

7,763

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧