Solved

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

Posted on 2002-06-26
6
527 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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
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.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

708 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

15 Experts available now in Live!

Get 1:1 Help Now