Originally posted by: beryl
you are really a genius!!
it is help a lots.
thank you!
Originally posted by: Amit Dalal
Gr8 work...has helped a lot
ReplyOriginally posted by: Jeff
Does anyone know how to save a web page using Internet explorer? (programmatically of course) Sounds very simple, but I just couldn't figure out how this can be done!!!
Please help?
ReplyOriginally posted by: Martijn
if(spBrowser != NULL) {
with
if(spBrowser != NULL) {
and you only have IE windows (or, actually, any window belonging to the Shell supporing IHTMLDocument2).
replace
_bstr_t str = spBrowser->GetLocationName();
int index = m_IEList.AddString(str);
spBrowser->AddRef();
m_IEList.SetItemDataPtr(index,spBrowser);
}
IDispatch* pDisp;
m_spDoc = (IHTMLDocument2*)NULL;
spBrowser->get_Document(&pDisp);
// is the IHTMLDocument2 interface supported? great, that's IE. others are Shell.
HRESULT hr = pDisp->QueryInterface(IID_IHTMLDocument2, (void**)&m_spDoc);
if(SUCCEEDED(hr)) {
_bstr_t str = spBrowser->GetLocationName();
int index = m_IEList.AddString(str);
spBrowser->AddRef();
m_IEList.SetItemDataPtr(index,spBrowser);
}
}
Originally posted by: N Srinivas J R
Hai Venu,
I have already implemented the DWebBrowserEvents2::DownloadBegin event, but I am not getting the response whenever a DownloadBegin event occurs.
I am herewith sending my code snippet.
Plz go through this and let me know, how can I capture the DownloadBegin Event, so that I can invoke my application for downloading any kind of http file from Internet.
Regards,
N Srinivas J R
BEGIN_DISPATCH_MAP(CIEEnumWindowsDlg, CCmdTarget)
DISP_FUNCTION_ID(CIEEnumWindowsDlg, "WindowRegistered",0x000000c8,WindowRegistered,VT_EMPTY,VTS_I4)
DISP_FUNCTION_ID(CIEEnumWindowsDlg, "WindowRevoked",0x000000c9,WindowRevoked,VT_EMPTY,VTS_I4)
/* this is added by me */
DISP_FUNCTION_ID(CIEEnumWindowsDlg, "DownloadBegin",0x0000006a,DownloadBegin,VT_EMPTY,VTS_NONE)
END_DISPATCH_MAP()
static SHDocVw::IShellWindowsPtr m_spSHWinds;
/*this is added by me */
static SHDocVw::DWebBrowserEvents2Ptr m_spEvents;
void CIEEnumWindowsDlg::DownloadBegin ( )
{
AfxMessageBox("DownloadBegin");
}
///////////////
void CIEEnumWindowsDlg::ConnectToShell() {
CoInitialize(NULL);
/*this block is added by me*/
if(m_spEvents.CreateInstance(__uuidof(SHDocVw::ShellBrowserWindow)) == S_OK)
{
//
// Sink for Events
//
LPCONNECTIONPOINTCONTAINER pConnPtCont;
if ((m_spEvents != NULL) &&
SUCCEEDED(m_spEvents->QueryInterface(IID_IConnectionPointContainer,
(LPVOID*)&pConnPtCont)))
{
ASSERT(pConnPtCont != NULL);
LPCONNECTIONPOINT pConnPt = NULL;
DWORD dwCookie = 0;
if (SUCCEEDED(pConnPtCont->FindConnectionPoint(__uuidof(SHDocVw::DWebBrowserEvents2), &pConnPt)))
{
ASSERT(pConnPt != NULL);
pConnPt->Advise( GetIDispatch(FALSE), &dwCookie);
pConnPt->Release();
}
pConnPtCont->Release();
}
}
else {
AfxMessageBox("WebBrowserEvents2 interface is not avilable");
}
/////////////////////////end of my addition///////////////////////
if(m_spSHWinds == 0) {
//
// Create Instance ShellWindows
//
if(m_spSHWinds.CreateInstance(__uuidof(SHDocVw::ShellWindows)) == S_OK) {
//
// Sink for Events
//
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( GetIDispatch(FALSE), &dwCookie);
pConnPt->Release();
}
pConnPtCont->Release();
}
}
else {
AfxMessageBox("Shell Windows interface is not avilable");
}
}
}
void CIEEnumWindowsDlg::WindowRegistered(long lCookie) {
OnOK() ;
}
void CIEEnumWindowsDlg::WindowRevoked(long lCookie) {
OnOK() ;
}
Reply
Originally posted by: janie
The errors I am getting are
\IEEnumWindows\Debug/shdocvw.tli(416) : error C2371: 'GetReadyState' : redefinition; different basic types
\IEEnumWindows\Debug/shdocvw.tli(418) : error C2664: 'get_ReadyState' : cannot convert parameter 1 from 'enum SHDocVw::tagREADYSTATE *' to 'enum tagREADYSTATE *'
Is this application supposed to compile ini VC5++?
Janie
I am having problems compilinging in VC++ 5
\IEEnumWindows\Debug/shdocvw.tli(416) : error C2556: 'GetReadyState' : overloaded functions only differ by return type
Error executing cl.exe.
Could you help me understand why it is not compiling correctly?
Originally posted by: msl
I have one question, that is if i can MODIFY the html retrived by HTMLDocument2 such as adding a script processing onclick event and then write back?
Originally posted by: Steve Such
Fantastic code, its helped me a lot. Thanks. I'm having a bit of trouble getting IWebBrowser2::Navigate to work, sometimes it gives me an abnormal program termination and other times it does nothing. Has anyone else experienced these problems?
Any help would be most appreciated.
Thanks
Steve
Originally posted by: T.S.
Hello,
i used your code of the demo project but changed one thing:
I set up a timer that refreshes the list every second.
Now, after a while after starting and shutting down several instances of the Internet Explorer, the program quits with
an Error Message saying "Microsoft Visual C++ Runtime: abnormal program termination".
What can be the cause???
Thanks,
T.S.
ReplyOriginally posted by: guruguru
like this
<script language=javascript src='main.js'></script>
like microsoft script debugger...