I want to run an outside .exe file from my program. How can i do that?
Printable View
I want to run an outside .exe file from my program. How can i do that?
VB Code:
Private Sub Command1_Click() 'IE For Example Shell "C:\Program files\interNet Explorer\IExplore.exe", vbNormalFocus End Sub
VB Code:
Private Sub Command1_Click() Shell "c:\YourFolder\YourFile.exe" End Sub
I prefer using ShellExecute as it has more optionsEither one, however, will work. :)VB Code:
Option Explicit 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 Const SW_SHOWNORMAL = 1 Private Sub Command1_Click() ShellExecute Me.hwnd, vbNullString, "c:\hack.exe", vbNullString, "C:\", SW_SHOWNORMAL End Sub