VB Code:
  1. Option Explicit
  2.  
  3. Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, _
  4. ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
  5.  
  6. Private Const SW_SHOWNORMAL As Long = 1
  7. Private Const SW_SHOWMINIMIZED As Long = 2
  8. Private Const SW_SHOWMAXIMIZED As Long = 3
  9.  
  10. Private Sub Command1_Click()
  11.     On Error GoTo MyError
  12.     Dim lRet As Long
  13.     lRet = ShellExecute(Me.hwnd, "Open", "C:\MyApp.exe", vbNullstring, "C:\", SW_SHOWNORMAL)
  14.     If lRet <= 32 Then
  15.         MsgBox "Error Shelling"
  16.     End If
  17.     Exit Sub
  18. MyError:
  19.     MsgBox Err.Number & " - " & Err.Description
  20. End Sub