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 Command1_Click()
Dim hyperjump
hyperjump = ShellExecute(0&, vbNullString, "f:\net.txt", vbNullString, vbNullString, vbNormalFocus)
end 
End Sub
2,api,用exitwindows函数

解决方案 »

  1.   

    一关闭当前程序时打开另一程序
    private sub Command1_click()
           shell(要启动的文件路径+文件名)
           end
       end sub

    Private Sub Form_Unload(Cancel As Integer)
     shell(YourFilePath)
    End Sub二 重启计算机
    Private Declare Function ExitWindowsEx Lib "user32" (ByVal uFlags As Long, _
    ByVal dwReserved As Long) As Long
    Private Const EWX_LOGOFF = 0
    Private Const EWX_SHUTDOWN = 1
    Private Const EWX_REBOOT = 2
    Private Const EWX_FORCE = 4Private Sub Command1_Click()Dim iAns As Integer
    Dim rVal As Long' Ask if the user is sure they want to exit.
    iAns = MsgBox("Are you sure you want to exit windows?", vbQuestion Or _
    vbYesNo, "Exit Windows")
    If iAns = vbYes Then
    rVal = ExitWindowsEx(EWX_SHUTDOWN, 0&)
    End If End Sub
      

  2.   

    '同意楼上的
    Const EWX_LOGOFF = 0
    Const EWX_SHUTDOWN = 1
    Const EWX_REBOOT = 2
    Const EWX_FORCE = 4
    Private Declare Function ExitWindowsEx Lib "user32" (ByVal uFlags As Long, ByVal dwReserved As Long) As LongPrivate Sub Command1_Click()
           Shell "C:\aa.exe", 1
           ExitWindowsEx EWX_SHUTDOWN, 0&
           End
    End Sub