✔ 最佳答案
雙撃按鈕1:
在Private Sub CommandButton1_Click()下加一句
Call Shell("C:\WINDOWS\System32\calc.exe")
完成了.
###############################################
如果要傳回結果用程式1叫程式2
WindowsApplication1
======================================================
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Process.Start("C:\Documents and Settings\mithun\Local Settings\Application Data\Temporary Projects\WindowsApplication2\bin\Debug\WindowsApplication2.exe", "hello")
End Sub
End Class
===============
WindowsApplication2
===============
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim strParam As String
strParam = Command()
TextBox1.Text = "Command Line Argument Received Was " & strParam
End Sub
End Class
2009-04-05 23:37:36 補充:
Dim shell, fso
Set shell = CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")
shell.Run """C:\Program Files\Microsoft Office\Office10\WINWORD.exe"" file.doc"
2009-04-05 23:38:33 補充:
http://www.devdos.com/vb/lesson1.shtml
2009-04-05 23:43:55 補充:
http://forums.aspfree.com/visual-basic-programming-38/calling-external-exe-file-from-vb-code-34234.html
Option Explicit
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA"
result = ShellExecute(Me.hwnd, "Open", "calc.exe", vbNullString, vbNullString
2009-04-05 23:45:41 補充:
(ByVal hwnd As Long, ByVal lpszOp As String, _
ByVal lpszFile As String, ByVal lpszParams As String, _
ByVal LpszDir As String, ByVal FsShowCmd As Long) _
As Long
Private Sub cmdLaunchCalc_Click()
Dim result As Long