I'm working on a project with a coworker and we have been beating our heads over our desks trying to figure this one out. Our requirements are to have a new Internet Explorer browser pop up with one webpage and then append two tabs to it. We found a solution that works on my coworker's computer, but when we tried it on my computer and another coworker's computer, it would not work. What we have so far:
using SHDocVw;
...
ShellWindows iExplorerInstances = new ShellWindows();
Process.Start("IExplore.exe", "www.reddit.com");
Thread.Sleep(5000);
string url = "http://www.google.com";
IEnumerator enumerator = iExplorerInstances.GetEnumerator();
enumerator.MoveNext();
InternetExplorer iExplorer = (InternetExplorer)enumerator.Current;
iExplorer.Navigate(url, 0x800); //0x800 means new tab
url = "http://www.banana.com";
enumerator = iExplorerInstances.GetEnumerator();
enumerator.MoveNext();
iExplorer = (InternetExplorer)enumerator.Current;
iExplorer.Navigate(url, 0x800); //0x800 means new tab
Again, this works correctly on only his computer. For me, when I try to run this code, it opens up the Internet Explorer browser correctly, but even though I'm using an InternetExplorer object, it opens up the tabs in Firefox. I delved into the class and tried to print out anything useful I could find. The name property in my InternetExplorer object was "Windows Explorer". I read up more on what ShellWindows actually does and that makes sense, but it doesn't help me. This seems to imply that it's opening up my default browser through the InternetExplorer object instead of Internet Explorer. I also had different results from my coworker who has Chrome as a default browser. I switched my default browser to Chrome to see if that was the issue, but then the two extra tabs opened in Chrome. All I really need is to open an Internet Explorer browser with 3 tabs each with their own URL. Any help is greatly appreciated.