How to open a url in new tab of IE8 using c# (window application) for window 7

I have created a toolbar for IE8. There is add button in the toolbar and onclick of that i want to open a url in the new tab.

I have used the following code which is working fine for window XP browser

System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo("IEXPLORE.EXE");
 startInfo.UseShellExecute = true;
 startInfo.FileName = url;

But for window 7 it opened the url in the new window but i want it to be opened in the new tab of same browser.

Is there any other way to do this for window 7 browser.

Waiting for ur response.

Who is Participating?
Kyle AbrahamsConnect With a Mentor Senior .Net DeveloperCommented:

Is your default setting to open a popup in a new window?  It could be a function of IE rather than your code.
Kyle AbrahamsSenior .Net DeveloperCommented:

This guy was trying to do something else but the code should open up a new tab.  There also seems to be a NewWindow2 event.
try the following code:


private static extern int ShellExecute(int hwnd, string lpOperation,

      string lpFile, string lpParameters,

      string lpDirectory, int nShowCmd);

public static int GoUrl(string lcUrl)

      string lcTPath = Path.GetTempPath();
      int lnResult = ShellExecute(0,"OPEN",lcUrl, "",lcTPath,1);

     return lnResult;
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

jasbirbrarAuthor Commented:
I already have tried these solutions but these are not working for window 7 browser. It opened the url in the new window instead of new tab of existing browser.
jasbirbrarAuthor Commented:
Actually I think the problem lies with the IE8 on Windows 7 only.
The default behaviour of IE8 is that for new window is that it doesn't start new Session. For new Session there already exists New Session option. But in my case it is starting new session by default.
Anything to counter that?
Kyle AbrahamsSenior .Net DeveloperCommented:
Would recommend a split between

ROIEB, Comment Id 26162766

Ged325, Comment ID 26189936
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.