how to run / execute other application and close it automatically after 5 minutes in visual basic 6 ?
execute and close application in vb6
Collapse
X
-
A quick search should find you the details on how to execute - it's a question which has been answered here a number of times.
As for the 5 minutes, I'd suggest you use something like the DateAdd function to add 5 minutes to the current time, then sit in a Do loop executing DoEvents until the time passes that value. Alternatively, you could set a Timer control to trigger your code. However, I think the maximum interval they can wait for is about a minute or something (possibly half a minute?) so you'd need to trigger a few times to reach 5 minutes. -
hi Killer42, thanks for answer.
I have successfull make a program to run a application and close it after 5 minutes and reopen it again after 3 seconds closed.
i used this codes to open a application :
and i use this procedure to close / terminate the application :Code:app = Shell(Environ$("programFiles") + "\Internet Explorer\iexplore.exe", vbNormalFocus)
Now i want to open firefox with a URL opened in a tab, i want to close that tab without closing firefox, anybody can help?Code:Private Sub TerminateProcess(app_exe As String) Dim Process As Object For Each Process In GetObject("winmgmts:").ExecQuery("Select Name from Win32_Process Where Name = '" & app_exe & "'") Process.Terminate Next End SubComment
Comment