
28/09/2005, 12:30
|
 | | | Fecha de Ingreso: mayo-2004 Ubicación: México
Mensajes: 2.702
Antigüedad: 20 años, 11 meses Puntos: 0 | |
O puedes hacer esto:
Código:
Public Comando As String
Private Const PROCESS_QUERY_INFORMATION = &H400
Private Const STILL_ACTIVE = &H103
Private Declare Function OpenProcess Lib "kernel32" _
(ByVal dwDesiredAccess&, ByVal bInheritHandle&, ByVal dwProcessId&) _
As Long
Private Declare Function GetExitCodeProcess Lib "kernel32" _
(ByVal hProcess As Long, lpExitCode As Long) _
As Long
Código:
Sub EsperarShell(sCmd As String)
Dim hShell As Long
Dim hProc As Long
Dim codExit As Long
' ejecutar comando
hShell = Shell(Environ$("Comspec") & " /c " & sCmd, 2)
' esperar a que se complete el proceso
hProc = OpenProcess(PROCESS_QUERY_INFORMATION, False, hShell)
Do
GetExitCodeProcess hProc, codExit
DoEvents
Loop While codExit = STILL_ACTIVE
MsgBox "El Proceso ha Terminado", vbInformation + vbOKOnly, "Mensaje"
End Sub
y lo mandas llamar asi:
Código:
comando="tu comando de ms-dos"
EsperarShell (Comando)
|