Visual Basic - delay, timer, wait etc

Life is soft - evento anual de software empresarial
 
Vista:

delay, timer, wait etc

Publicado por Vanella (23 intervenciones) el 23/02/2005 23:48:27
Tengo un programa que debe llamar dos ejecutables, (A y B), sin embargo el ejecutable B no puede empezar hasta tanto el ejecutable A haya terminado de correr, necesito utilizar un comando como el wait, pero que no dependa del tiempo, porque no es constante, quiero buscar una manera que la orden de ejecutar B se efectue cuando A haya terminado...que me sugieren ..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

RE:delay, timer, wait etc

Publicado por ChaRLinux (60 intervenciones) el 24/02/2005 00:15:02
tus otros programas son hechos por ti o son de otro creador
y otra pregunta quieres que cuando el programa A se haya terminado de cargar o cuando tu programa A se cierre entonses se abra el otro
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

RE:delay, timer, wait etc

Publicado por Vanella (23 intervenciones) el 24/02/2005 00:29:43
Los otros programas son hechos por mi, pero esta uno en matlab y el otro en fortram...... Quiero que se ejecute primero el programa A, este tiene como funcion crear un archivo .txt, luego se debe ejecutar B, este lee el archivo .txt creado por A y crea otro archivo.......por ello necesito que primero se ejecute A y solo despues que se termine, se ejecute B..
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

RE:delay, timer, wait etc

Publicado por ChaRLinux (2 intervenciones) el 24/02/2005 01:15:11
mira te voy a explicar como le podrias hacer ok
en tu formulario de visual basic pones un timer y en el timer pones lo siguiente
A = Dir("c:\tu archivo.txt", vbArchive)
Text1.Text = A

ok ahora en otro timer pones lo siguiente
if text1.text<>"" then
EN ESTA LINEA MANDAS LLAMAR EL SEGUNDO PROGRAMA "B"
timer1.enabled=false
ENDIF
ok te explico
ejecutas tu formulario de visual basic donde nadamas ejecute el programa "A" LO QUE VAN A HACER LOS TIMER EL PRIMERO TE VA A DETECTAR SI EL ARCHIVO YA FUE CREADO Y SI YA LO CREO TU PROGRAMA "A" ENTONSES EN TU FORMULARIO DE VISUAL BASIC EN EL TEXT1.TEX TE VA APARECER EL NOMBRE DEL ARCHIVO Y ENTONCES ENTRA EL TIMER 2 DONDE HACE LA CONDICION DE QUE SI YA EL TEXT1.TEXT YA NO ESTA VACIO ENTONCES EN ESE MOMENTO EJECUTA EL PROGRAMA "B" PARA QUE PUEDA LEER EL ARCHIVO
ESPERO TE SIRVA sino telo vuelvo a explicar
ChaRLinux Corporation
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

RE:delay, timer, wait etc

Publicado por Benjo (679 intervenciones) el 24/02/2005 01:53:49
Utiizando una iteraciòn y la API GetExitCodeProcess

Este ejemplo ejecuta calc.exe yt te muestra un mensaje cuando se cierra.
'*** Monitoring a DOS Shell
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)
Const STILL_ACTIVE = &H103
Const PROCESS_QUERY_INFORMATION = &H400
Sub Shell32Bit(ByVal JobToDo As String)

Dim hProcess As Long
Dim RetVal As Long
'The next line launches JobToDo as icon,

'captures process ID
hProcess = OpenProcess(PROCESS_QUERY_INFORMATION, False, Shell(JobToDo, 1))

Do

'Get the status of the process
GetExitCodeProcess hProcess, RetVal

'Sleep command recommended as well as DoEvents
DoEvents: Sleep 100

'Loop while the process is active
Loop While RetVal = STILL_ACTIVE
MsgBox "se cerró la aplicación"

End Sub

Private Sub Command1_Click()
Shell32Bit "calc.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