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
Solved

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

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
repeatEnd java challenge 42 85
Error on moodle after upgrade 3 140
either24  challenge 19 101
MaxSpan challenge 9 104
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…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

792 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