Global startTime.i, notepad.i
Procedure activityMonitor(*dummy)
Repeat
If ElapsedMilliseconds() - startTime > (5 * 1000) *1 ; 5 seconds
Debug "5 seconds"
KillProgram(notepad)
ProcedureReturn
EndIf
Delay(250)
ForEver
EndProcedure
monitoringThread = CreateThread(@activityMonitor(), 0)
startTime.i = ElapsedMilliseconds()
notepad = RunProgram("C:\Windows\System32\notepad.exe","","", #PB_Program_Open)
; do my other stuffs
; this could be an event loop for a Window, or some other task that lasts longer than 5 seconds.
; you could have this loop below at the end of your program, so that it still waits for notepad.exe to finish
While (IsProgram(notepad) and ProgramRunning(notepad))
Delay(1)
Wend
Bas Groothedde,
Imagine Programming
I live in a philosophical paradoxal randome filled with enigma's!
Global startTime.i, notepad.i
Procedure activityMonitor(*dummy)
Repeat
If ElapsedMilliseconds() - startTime > (5 * 1000) *1 ; 5 seconds
Debug "5 seconds"
KillProgram(notepad)
ProcedureReturn
EndIf
Delay(250)
ForEver
EndProcedure
monitoringThread = CreateThread(@activityMonitor(), 0)
startTime.i = ElapsedMilliseconds()
notepad = RunProgram("C:\Windows\System32\notepad.exe","","", #PB_Program_Open)
; do my other stuffs
; this could be an event loop for a Window, or some other task that lasts longer than 5 seconds.
; you could have this loop below at the end of your program, so that it still waits for notepad.exe to finish
While (IsProgram(notepad) and ProgramRunning(notepad))
Delay(1)
Wend