Solved

HOW do i open an IE instance in the same process as my application's webbrowser process

Posted on 2002-06-26
6
529 Views
Last Modified: 2013-11-20
I have a webbrowser control in my application. The links in the page that is displayed in the webbrowser, which should be opened in new windows, do not open properly. (i'e, window.open(...)).
The problem is probably related to cookies. The cookie of the webbrowser is not shared with the newly opened instance of ie. (Not in the same process).

When i catch the OnNewWindow2 event of the webbrowser, and set the *ppDisp to another webbrowser in my application, it does open correctly. (The new webbrowser control is opened in the same process as the client who called it).

I'd like to be able to open a link in an IE window which is a part of my application.

I tried using the following code:
LPVOID * m_pIE;
HRESULT hr = CoCreateInstance(CLSID_InternetExplorer,
                               NULL,
                               CLSCTX_INPROC_SERVER,
                               IID_IWebBrowser2,
                               (void**)&m_pIE);
if (hr == S_OK)
     *ppDisp = (IDispatch*)m_pIE;

But since the InternetExplorer object is of type .EXE it is opened out-of-process.

If anyone has other ideas. Please share.
Or, if anyone knows where i can find code of IE browser application, so that i can add it to my code. Also helpful.
0
Comment
Question by:Michal080800
  • 2
6 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 250 total points
ID: 7111331
Hmm, the following article might provide an alternative:

http://support.microsoft.com/default.aspx?scid=kb;EN-US;q176792 ("HOWTO: Connect to a Running Instance of Internet Explorer (Q176792)")
0
 
LVL 1

Assisted Solution

by:ackava
ackava earned 250 total points
ID: 7174083
Hi Michal,

If you do window.open from an html page then your code should work perfect if your cookies are set to be available for complete website, do you know that there are scopes of cookies, one is page, and one is complete website etc depends on what path you give, the cookie set for complete website are globly available from any instance of browser but in the same process, but if you call window.open then it is always the same process

I doubt your code for cookie itself, can you try your html code on browser rather then your application ans see if it works. If on browser also it works perfect then your code for cookie might be wrong, I also got same error in past then I used following code for cookies and it worked!!

I am here attaching cookie.js which will help you out to understand and write cookies.

function setCookie(name, value, expires, path, domain, secure)
{
    var curCookie = name + "=" + escape(value) +
          ((expires) ? "; expires=" +
                expires.toGMTString() : "") +
          ((path) ? "; path=" + path : "") +
          ((domain) ? "; domain=" + domain : "") +
          ((secure) ? "; secure" : "");
          document.cookie = curCookie;
}


// to set cookie call

setCookie("Name","Value","","/")

// specifying "/" means cookie in scope of whole website and accessible everywhere
0
 
LVL 86

Expert Comment

by:jkr
ID: 12036025
I'd say the Q is answered.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Expand to include initial dialog with two choices. 9 67
dog bark java program 15 87
move a line in eclipse 3 82
Line meaning 9 82
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

895 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now