Connecting to Running Instances of Internet Explorer
Posted
by Venu Vemula & Robert Walker
on January 16th, 2001
Not only shell windows keeps track of all shell windows and also notifies when new shell window is created or deleted.
When you enumerate, you can query whether the entry supports IWebBrowser interface, if it does it could be either WebBrowser or ShellBrowser. Once you get hold of IWebBrowser2 interface, you can either use it or listen to DWebBrowserEvents or through it away.
Before you start cranking in, you should include
#import "mshtml.tlb": // Internet Explorer 5
#import "shdocvw.dl"
Connecting To web browser using shell windows interface
void CIEEnumWindowsDlg::ConnectToShell()
{
CoInitialize(NULL);
if(m_spSHWinds == 0) {
//
// Get reference to ShellWindows interface
//
if(m_spSHWinds.CreateInstance(__uuidof(SHDocVw::ShellWindows))
== S_OK) {
// Event Sink
//
LPCONNECTIONPOINTCONTAINER pConnPtCont;
if ((m_spSHWinds != NULL) &&
SUCCEEDED(m_spSHWinds->QueryInterface(IID_IConnectionPointContainer,
(LPVOID*)&pConnPtCont))) {
ASSERT(pConnPtCont != NULL);
LPCONNECTIONPOINT pConnPt = NULL;
DWORD dwCookie = 0;
if (SUCCEEDED(pConnPtCont->FindConnectionPoint(
__uuidof(SHDocVw::DShellWindowsEvents), &pConnPt)))
{
ASSERT(pConnPt != NULL);
pConnPt->Advise( this->GetIDispatch(FALSE), &dwCookie);
pConnPt->Release();
}
pConnPtCont->Release();
}
}
else {
AfxMessageBox("Shell Windows interface is not avilable");
}
}
}

Comments
Need code in c#
Posted by sharath1984 on 04/15/2011 06:17amHi, I am having a Web app published in Citrix environment. But when I click on a url it will show a blank IE screen. So can you pls give the above written code in c#.net. Thanks in Advance.
ReplyApllication crashes when trying to read URL's in a timer??
Posted by Legacy on 01/24/2004 12:00amOriginally posted by: Himanshu
Hi,
ReplyI am having a problem that applcaition is crashing when i try to list all IE url's in a timer for whole day using a timer. The problem is occurring once in a while and it happens randomly at any place or URL. i.e. suppose my applciation is trying to read a URL and at the same instant user closes IE the browser pointer is still there but it is unable to read URL as the window has been closed. I am also using try catch exception blocks to catch the exception thrown but each time it fails to catch the exception raised and shows abnormal program termination. Is there any way i can read the URL's and can avoid this error. Please help I need to fix this problem. Any help or pointers are highly appreciated. Thanks a lot in advance.Looking forward to a help. Please..
Regards,
Himanshu
crashing problem? abnormal program termination
Posted by Legacy on 01/06/2004 12:00amOriginally posted by: Himanshu
Hi all,
I am having a problem when i use this to read url's from IE..It terminates itself and shows an abnormal program termination error..I need to sort this problem out..Can someone help me out in doing the same..i need this to be done..Please help me out..any help or poinetrs are thoroughly appreciated...Thanks a lot in advance..
ReplyRegards,
Himanshu
DocumentComplete() / NavigateComplete2() technique
Posted by Legacy on 11/01/2003 12:00amOriginally posted by: TheFlashback
ReplyURGENT - Calling IE programmatically and Hiding display
Posted by Legacy on 10/30/2003 12:00amOriginally posted by: Varun
ReplyHow can I set the proxy to use by connected running instance
Posted by Legacy on 08/14/2003 12:00amOriginally posted by: agsapt
I would like to know if it's possible that once we are connected to a running instance, we can set a proxy to use by that running instance? If that's possible then how?
Replyhow to fire BeforeNavigate2 event???
Posted by Legacy on 08/05/2003 12:00amOriginally posted by: rain
I want to get a notification when user input a url in address bar or click a link, I think this can be done by capture BeforeNavigate2 event, but I failed to get the notification of this event, what can I do to get the notification? Thanks!
ReplyNeed help -> FileDownload eventhandler not firing
Posted by Legacy on 07/18/2003 12:00amOriginally posted by: Dickson
After connecting to an instance of IE, i'm trying to control/monitor the events. So far everything works but the filedownload event handler. Anybody have any tips on how to do it? The following (C#) is the syntax for all of my event handlers.
myInternetExplorer.FileDownload += new SHDocVw.DWebBrowserEvents2_FileDownloadEventHandler(OnDownload);
Any clues/pointers would be helpful! I want to build my own download manager :)
Thanks,
ReplyDickson
how to set URL
Posted by Legacy on 07/08/2003 12:00amOriginally posted by: tony
anyone know how can I use a simple wrapper class/application such at I can from my application tell the instant to visit the url one by one? I don't need to get anything back, just need to visit the links and make sure the links are all working.
thanks
ReplyPossibility to use Navigate ?
Posted by Legacy on 05/26/2003 12:00amOriginally posted by: Philippe Legrand
ReplyLoading, Please Wait ...