在调用中,需要用到API函数。
程序代码如下:
'声明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
Private Sub Command1_Click()
ShellExecute Me.hWnd, "open", "CALC.exe", "", 1, 5 '调用计算器
End Sub
Private Sub Command2_Click()
End '退出
End Sub
运行界面如下图: