Win.ShellExecute 0, "open", "C:\dir\program.exe", "arguments", vbNullString, SW_SHOWNORMAL
Win.ShellExecute 0, "open", "http://www.google.com", vbNullString, vbNullString, SW_SHOWNORMAL
I want google.com to open regardless of whether or not program.exe is still running. How do I fix this? I would rather avoid things like calling "start."
Both of these calls happen pretty much instantly, and the VB program continues running. However, on both Vista and XP, google.com does not open until program.exe closes. If the application which called shellexecute
closes before program.exe closes, google.com will still open once program.exe is closed.
Note:
I have found that having program.exe call doevents every 100ms or so fixes the problem, but obviously this is somewhat of a hack.
Note2:
Below is an example implementation of program.exe. Yes, I realize that changing program.exe will fix this (i.e. adding a doevents
call).
Option Explicit
Public Sub Main()
Do Until False
Sleep 100
Loop
End Sub