rbulph Posted December 8, 2009 Posted December 8, 2009 How can I open a web page and then get the handle of the window it's opened in? I've tried the following as a start, but, although the web page opens OK, k is always Nothing. Dim k As System.Diagnostics.Process = Process.Start("http://www.google.com") Quote
Administrators PlausiblyDamp Posted December 8, 2009 Administrators Posted December 8, 2009 Process.Start only returns a process object if it has to create a new process, there is a good chance that there is already a web browser open and this process will be reused. Depending on what you are trying to do (and if you want to honour the users' browser choice or not) you could always add a reference to IE and use that... Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
rbulph Posted December 9, 2009 Author Posted December 9, 2009 Even if I close down all browser windows before running this line of code, k is still Nothing. I'm trying to log-in to an account of mine automatically at a certain time of day. I have Firefox as my default browser which has the advantage that my username and password are completed automatically and all I have to do is click the button for logging in. I want the handle of the window so that I can ensure that it is the foreground window and I can click on the button (which I can do automatically). I suppose I could just note what the text of the log-in window is and use FindWindow, but it would seem better if I can get the handle from when I open the page, because the text might change in time. Quote
Guest Boality09 Posted December 14, 2009 Posted December 14, 2009 Beastux. I did what you suggested, and now its working like a champ. I cant say though that I understood much of what I was doing when I was following your recipe. Now, if only the reverse could be done, i.e. have Firefox open a compose window in Thunderbird when I click on an email address in a web page. At this point Im only getting an error message mailto is not a registered protocol. Any suggestions? Quote
rbulph Posted December 14, 2009 Author Posted December 14, 2009 Beastux. I did what you suggested, and now its working like a champ. I cant say though that I understood much of what I was doing when I was following your recipe. Now, if only the reverse could be done, i.e. have Firefox open a compose window in Thunderbird when I click on an email address in a web page. At this point Im only getting an error message mailto is not a registered protocol. Any suggestions? Have you posted this in the wrong thread? Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.