|
-
Oct 3rd, 2000, 01:42 PM
#1
Thread Starter
Member
How can i call a exe file in visual basic, to execute it.
-
Oct 3rd, 2000, 01:45 PM
#2
Addicted Member
Dim r As Long
lblCurrentPath.Caption = lblCurrentPath.Caption + "\" + cboSelection.Text
r = StartDoc(lblCurrentPath.Caption)
212 will lead you to the truth
-
Oct 3rd, 2000, 01:49 PM
#3
Lively Member
Dim RetVal as Long
RetVal = Shell("C:\MyDirectory\My.exe", vbNormalFocus)
-
Oct 3rd, 2000, 01:55 PM
#4
It is best to use the ShellExecute api function. This is good because it will load any program no matter what. Whereas the regular Shell function may cause an error if it cannot load the file or if it doesn't exist.
Code:
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
Public Const SW_SHOWNORMAL = 1
ShellExecute Me.hwnd, vbNullString, "C:\file.exe", vbNullString, "c:\", SW_SHOWNORMAL
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|