使用ShellExecute函数:
先声明如下API:
Option Explicit
'声明API函数用于异步打开一个文档
Private 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 LongPrivate Const SW_SHOWNORMAL = 1
然后在过程中调用:
private Sub CmdHelp_Click()
dim a as long
Dim b As String
b = App.Path & "\help.chm" '用变量b记录与主程序同目录下的help.chm帮助文件
a = ShellExecute (0, "open", b, "", "", SW_SHOWNORMAL)
End Sub
问题是,前面声明的部分
Option Explicit
'声明API函数用于异步打开一个文档
Private 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 LongPrivate Const SW_SHOWNORMAL = 1
在什么地方声明呢?我把它加在窗口函数的global declaration中,但是我下面其他的函数就像是没有声明一样,不能调用了.这句声明应该放在什么地方呢???

解决方案 »

  1.   

    帮助文件调用要这样麻烦吗?
    不是就1句话吗
    在maim中写 app.helpfile=App.Path & "\help.chm"
      

  2.   

    修改成如下代码:
    a= ShellExecute (Me.hWnd, "open", b, "", "", SW_SHOWNORMAL)
      

  3.   

    但是 ShellExecute这个函数没有声明就不能用呀,我就是想问一下在什么地方声明这个函数
      

  4.   


    在主窗体maim中写 
    app.helpfile=App.Path & "\help.chm"当前目录下的帮助文件
    应该就可以解决了
    这个东西我以前用过
      

  5.   

    可以用htmlhelp函数直接打开:参见:http://www.china-askpro.com/msg2/qa28.shtml