Search code examples
exceptionvb6topmostdefault-browser

VB6 - Add exception to TopMost


I have been searching this for few hours, but without proper results. What I want to do, is make an external window to topmost, over my form1. So my form1 is topmost, but when default browser is opened via shellexecute, it should stay on top, until closed.

My code is:

   Dim r As Long
   r = ShellExecute(0, "open", "http://www.google.com", 0, 0, 1)

And when "google.com" is opened, the default browser should stay on top, until closed as I mentioned earlier.

Is there any decent solution available? If so, I would appreciate if anybody could tell me how to do it.


Solution

  • Use WaitForSingleObject winapi function to wait till the browser window is closed. Check the following links for the same:

    How to wait for a shell process to finish before executing further code in VB6

    http://www.ex-designz.net/apidetail.asp?api_id=539

    http://us.generation-nt.com/answer/how-start-notepad-modal-dialog-vb-application-help-54054422.html