How can I use the process class to launch the default browser in a new window.
Process.Start("www.google.com"); does not work. It will open a new tab in an exisiting IE instance.
Printable View
How can I use the process class to launch the default browser in a new window.
Process.Start("www.google.com"); does not work. It will open a new tab in an exisiting IE instance.
I'm amazed that even works at all. It does, I tested it, but seems odd. Anyway, you can launch the user's default browser as the process instead and pass the url as a command line argument.
Thanks for responding. By providing just the url, it will ensure that whatever the default browser is set to will launch the page. But my problem is I need the page to launch in a new window. I only use I.E., but I believe firefox, and oprah (lol, ... sorry opera) browsers use tabbed browsing as well. I need the browser to launch in a new window for the task I have at hand. I have already tried specifically launching I.E and setting the argument, and the result is the same.
Thanks, didn't know that. If you start the browser by its executable path with the url as an argument I thought that it starts a brand new process, i.e., new window. let me check..
Yup, this code opens a new window for me every time. However, if I go for the default http\shell\open command, it opens another tab for me in firefox.
Code:public partial class Form1 : Form
{
public Form1()
{
Process.Start(GetDefaultBrowserPath(), "www.google.com");
}
private string GetDefaultBrowserPath()
{
//string key = @"http\shell\open\command"; <--opens a new tab
string key = @"htmlfile\shell\open\command";
Microsoft.Win32.RegistryKey registryKey =
Microsoft.Win32.Registry.ClassesRoot.OpenSubKey(key, false);
return ((string)registryKey.GetValue(null, null)).Split('"')[1];
}
}
well, that worked, but I'm still in a bind.
I'm trying to setparent for the browser window.
Any ideas?
Here's basically what I got:
Code:Process PR = new Process();
PR = Process.Start(GetDefaultBrowserPath(),"www.yahoo.com");
PR.WaitForInputIdle();
//System.Threading.Thread.Sleep(10000);
SetParent(PR.MainWindowHandle, thisPanel2.Handle);
I can not find anything about changing a webbrowser's parent, specifically I.E. on google. I am creating a new thread here and marking this thread resolved.