Visual Basic - COMO CONTROLAR EL FINAL DE UN EJECUTABLE .

Life is soft - evento anual de software empresarial
 
Vista:

COMO CONTROLAR EL FINAL DE UN EJECUTABLE .

Publicado por VLG (139 intervenciones) el 23/02/2004 12:35:35
El problema es el siguiente , en un proceso llamo a un programa mediante la instruccin SHELL , me interesaria saber como puedo controlar el final de la aplicacion ejecutada mediante el SHELL
MUCHAS GRACIAS....
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

YA LO TENGO ....

Publicado por VLG (139 intervenciones) el 23/02/2004 19:55:22
Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, _
ByVal bInheritHandle As Long, _
ByVal dwProcessId As Long) _
As Long
Private Declare Function GetExitCodeProcess Lib "kernel32" (ByVal hProcess As Long, _
lpExitCode As Long) _
As Long
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Const STILL_ACTIVE = &H103
Private Const PROCESS_QUERY_INFORMATION = &H400
Dim hProcess As Long
Dim RetVal As Long

Public Function EjecutaAPP(ByVal Tarea As String) As Boolean
hProcess = OpenProcess(PROCESS_QUERY_INFORMATION, False, Shell(Tarea, 1))
Do
GetExitCodeProcess hProcess, RetVal
DoEvents: Sleep 100
Loop While RetVal = STILL_ACTIVE
If RetVal = 0 Then EjecutaAPP = True: MsgBox ("Proceso terminado")

End Function

Private Sub Command1_Click()
Call EjecutaAPP("c:\windows\NOTEPAD.EXE")
End Sub
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar