|
|
Subject:
C++ Grab Current URL from Active IE6 Window
Category: Computers > Programming Asked by: pablodiablo-ga List Price: $20.00 |
Posted:
21 Feb 2006 17:13 PST
Expires: 23 Mar 2006 17:13 PST Question ID: 448103 |
I am trying to write a Visual 2005 C++ program to grab the current url from the active IE window... I am stuck.. here is what I've got so far: #include "stdafx.h" #include <iostream> using namespace std; #include <windows.h> #include <objbase.h> #include <exdisp.h> #import <shdocvw.dll> int main() { long check = 0; HRESULT hr; BSTR *strRay = new BSTR[1000]; SHDocVw::IShellWindowsPtr spSHWinds; IWebBrowser2 *m_pWebBrowser = NULL; IDispatchPtr spDisp; CoInitialize(0); spSHWinds.CreateInstance (__uuidof(SHDocVw::ShellWindows)); check = spSHWinds->GetCount(); for (long i = 0; i < check; i++) { _variant_t va(i, VT_I4); spDisp = spSHWinds->Item(va); SHDocVw::IWebBrowser2Ptr spBrowser(spDisp); if (spBrowser != NULL) { hr = spBrowser->get_LocationURL(strRay); //HRESULT IWebBrowser2::get_LocationURL(BSTR *pbstrLocationURL); } } cout << (check - 1) << " ie windows are open\n"; cout << hr << " is the url\n"; return 0; } |
|
There is no answer at this time. |
|
Subject:
Re: C++ Grab Current URL from Active IE6 Window
From: msimonelli-ga on 26 Feb 2006 17:42 PST |
You mean grab the URL from an IE addin that you're creating, or from a seperate running process? |
Subject:
Re: C++ Grab Current URL from Active IE6 Window
From: jiangsheng-ga on 22 Mar 2006 09:38 PST |
you can find the window with a window class "IEFrame" and the highest z-order See my article http://www.codeproject.com/shell/AutomateShellWindow.asp |
If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you. |
Search Google Answers for |
Google Home - Answers FAQ - Terms of Service - Privacy Policy |