shell hh.exe 文件名及路径 ,1

解决方案 »

  1.   

    Shell "hh.exe " & App.Path & "/help.chm", vbNormalFocus
      

  2.   

    先在程序中加入如下的声明后,就能引用这个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 Long  其中各个参数的意义如下表所示:参数  意义  
    hwnd Long,指定一个窗口的句柄,有时windows程序要在创建自己的主窗口前显示一个消息框 
    lpOperation String,指定字串“open”来打开lpFlie文档,或指定“Print”来打印它 
    lpFile String,想用关联程序打印或打开一个程序名或文件名 
    lpParameters String,如lpszFlie是可执行文件,则这个字串包含传递给执行程序的参数 
    lpDirectory String,想使用的完整路径 
    nShowCmd Long,定义了如何显示启动程序的常数值 
      

  3.   

    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 Sub Form_Load()
    Call ShellExecute(Form1.hwnd, "Open", "f:\vbch.chm", "", App.Path, 1)End Sub