?
Solved

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

Posted on 2009-12-31
8
Medium Priority
?
1,809 Views
Last Modified: 2012-05-08
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;
 System.Diagnostics.Process.Start(startInfo);

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.

Thanks
0
Comment
Question by:jasbirbrar
  • 3
  • 2
6 Comments
 
LVL 41

Expert Comment

by:Kyle Abrahams
ID: 26153248
http://www.dreamincode.net/forums/showtopic58684.htm

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.
0
 
LVL 3

Expert Comment

by:roeib
ID: 26162766
try the following code:

DllImport("Shell32.dll")]

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;
}
0
 

Author Comment

by:jasbirbrar
ID: 26168962
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.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:jasbirbrar
ID: 26178089
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?
0
 
LVL 41

Accepted Solution

by:
Kyle Abrahams earned 2000 total points
ID: 26189936
http://www.winvistatips.com/ie8-can-ie8-open-new-tab-click-hyperlink-t805903.html

Is your default setting to open a popup in a new window?  It could be a function of IE rather than your code.
0
 
LVL 41

Expert Comment

by:Kyle Abrahams
ID: 26513427
Would recommend a split between

ROIEB, Comment Id 26162766

and
Ged325, Comment ID 26189936
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question