Saturday, November 14, 2009

Execute a file with its default program

To execute application or file using vb6 you can insert this code:

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

Public Sub RunCMD(Optional Filename As String)
Call ShellExecute(0&,vbNullString,Filename, vbNullString, _
vbNullString, vbNormalFocus)
End Sub

No comments:

Post a Comment