Solved

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

Posted on 2002-06-26
6
533 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

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!

Question has a verified solution.

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

Suggested Solutions

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses

738 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