Solved

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

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
iSeries FTP Exit Program 8 135
how to monitor remote shell execution on linux 9 100
FizzBuzz challenge 9 80
Capture logon name 13 70
In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
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.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

786 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