Create a form with a command button then paste in this code. It will
start Notepad. This will give you a good example of what u need.
Private Declare Function WaitForSingleObject Lib "kernel32" _
(ByVal hHandle As Long, ByVal dwMilliseconds As Long) As Long
Private Declare Function CloseHandle Lib "kernel32" _
(ByVal hObject As Long) As Long
Private Declare Function OpenProcess Lib "kernel32" _
(ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, _
ByVal dwProcessId As Long) As Long
Private Const INFINITE =3D -1&
Private Const SYNCHRONIZE =3D &H100000
Private Sub Command1_Click()
Dim iTask As Long, ret As Long, pHandle As Long
iTask =3D Shell("notepad.exe", vbNormalFocus)
pHandle =3D OpenProcess(SYNCHRONIZE, False, iTask)
ret =3D WaitForSingleObject(pHandle, INFINITE)
ret =3D CloseHandle(pHandle)
MsgBox "Process Finished!"
End Sub
-----Original Message-----
From: Miles Baker [mailto:miles@b...]
Sent: Friday, January 31, 2003 9:49 AM
To: professional vb
Subject: [pro_vb] Re: EXe
You can use the 'Shell' command which returns a double of the program#s
task
ID or zero if it fails..
Miles
----- Original Message -----
From: "maryam a" <m_ctrl_a@y...>
To: "professional vb" <pro_vb@p...>
Sent: Friday, January 31, 2003 3:48 PM
Subject: [pro_vb] EXe
>
> hi
>
> how can i call a Exe File from Vb?
>
> tnx
>
> Maryam
>
>
>
> ---------------------------------
> Do you Yahoo!?
> Yahoo! Mail Plus - Powerful. Affordable. Sign up now
>