Visual Basic - toni

Life is soft - evento anual de software empresarial
 
Vista:

toni

Publicado por solo expertos (9 intervenciones) el 05/11/2003 22:00:40
Como puedo cerrar una aplicacion que he lanzado desde VB, este el codigo que tengo por favor que alguien me ayude

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 Declare Function TerminateProcess Lib "kernel32" (ByVal hProcess As Long, ByVal uExitCode As Long) As Long

Private Declare Function WaitForSingleObject Lib "kernel32" _
(ByVal hHandle As Long, ByVal dwMilliseconds As Long) As Long

Private Const INFINITE = -1&
Private Const SYNCHRONIZE = &H100000


iTask = Shell("notepad.exe", vbNormalFocus)
pHandle = OpenProcess(SYNCHRONIZE, False, iTask)
ret = WaitForSingleObject(pHandle, 100)
a = TerminateProcess(pHandle, 0)
ret = CloseHandle(pHandle)
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder