Jorge Bergasa
2003-11-28 13:43:08 UTC
Hello all!
I am developing an Internet Explorer toolbar that performs some actions on
NavigateComplete only if the page is loaded in a pop-up window.
In order to know whether the page is loaded in a pop-up window, I catch
NewWindow2 to create my own InternetExplorer object and store its IDispatch
into a vector. Then, on NavigateComplete, I look for the pDisp that comes as
a parameter in the vector. If the pDisp is in the vector, this means that
the page is being loaded in the pop-up created on NewWindow2. Easy.
The problem is that the pDisps of each event do not match. I have made sure
that my vector is working properly, and I also tried to see what the values
of Container and Application were, with no luck.
Anyone has an idea of what I am doing wrong / is going wrong? If not, anyone
has an idea of how to know whether a navigation is made from a pop-up window
or not, on NavigateComplete?
Here are some code snippets:
void __stdcall CCoMyToolbar::OnNewWindow2 (IDispatch **ppDisp, VARIANT_BOOL
*cancel)
{
CoCreateInstance(CLSID_InternetExplorer, NULL, CLSCTX_SERVER,
IID_IDispatch, (LPVOID*)ppDisp);
ATLASSERT(*ppDisp != NULL);
m_newWindows->Add(*ppDisp);
}
void __stdcall CCoBrowserFilter::OnOBNavigateComplete (IDispatch *pDisp,
VARIANT *vtUrl)
{
if (m_newWindows->Exists(pDisp) == S_OK)
{
... Do something...
}
else
{
...Do something else...
}
}
I am developing an Internet Explorer toolbar that performs some actions on
NavigateComplete only if the page is loaded in a pop-up window.
In order to know whether the page is loaded in a pop-up window, I catch
NewWindow2 to create my own InternetExplorer object and store its IDispatch
into a vector. Then, on NavigateComplete, I look for the pDisp that comes as
a parameter in the vector. If the pDisp is in the vector, this means that
the page is being loaded in the pop-up created on NewWindow2. Easy.
The problem is that the pDisps of each event do not match. I have made sure
that my vector is working properly, and I also tried to see what the values
of Container and Application were, with no luck.
Anyone has an idea of what I am doing wrong / is going wrong? If not, anyone
has an idea of how to know whether a navigation is made from a pop-up window
or not, on NavigateComplete?
Here are some code snippets:
void __stdcall CCoMyToolbar::OnNewWindow2 (IDispatch **ppDisp, VARIANT_BOOL
*cancel)
{
CoCreateInstance(CLSID_InternetExplorer, NULL, CLSCTX_SERVER,
IID_IDispatch, (LPVOID*)ppDisp);
ATLASSERT(*ppDisp != NULL);
m_newWindows->Add(*ppDisp);
}
void __stdcall CCoBrowserFilter::OnOBNavigateComplete (IDispatch *pDisp,
VARIANT *vtUrl)
{
if (m_newWindows->Exists(pDisp) == S_OK)
{
... Do something...
}
else
{
...Do something else...
}
}