PDA

Click to See Complete Forum and Search --> : run specified application.


Dec 23rd, 2000, 10:47 AM
Hello,

Can anyone can tell me how can i run a program outside
my application optional parameters and please give
example.

thanks.

Dec 23rd, 2000, 11:46 AM
You can use the Shell function that is part of VB.
Shell will only launch executable files, but you may add parameters along with it.

Shell "C:\MyProgram\Program.exe '/a /b /parameters

'You can also have it return a TaskID
RetVal = Shell("C:\MyProgram\Program.exe /a /b /parameters", vbNormalFocus)

Shell "Notepad.exe C:\MyFile.txt", 1

Or you can use the ShellExecute API function which will load any file with it's default application.

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

Usage

ShellExecute Me.hwnd, vbNullString, "C:\txtfile.txt", _
vbNullString, "c:\", SW_SHOWNORMAL