Hello All,
I am having a problem getting the sample given by Igor to compile.
http://groups.google.ca/groups?q=igor+javascript+bho&hl=en&lr=&ie=UTF-8&oe=UTF-8&selm=OgXvZkltCHA.1844%40TK2MSFTNGP09&rnum=2
I put the following code in the Invoke() method of my Toolbar...
case DISPID_NAVIGATECOMPLETE2:
{
// toolbar to sink NavigateComplete2 event and install an IDispatch pointer to
// some object it implements as a property of window object.
//
// This code is adapted from...
//
http://groups.google.ca/groups?q=bho+javascript+igor&hl=en&lr=&ie=UTF-8&oe=UTF-8&selm=OUSLCdyJBHA.1952%40tkmsftngp02&rnum=4
// which was written by Igor Tandetnik (the BHO/Toolbar Guru)
//
// This will allow me to script the following on a web page ...
// window.TickerToolbar.foo()
;
//
IDispatch *frame;
m_webBrowserPtr->get_Docum
ent( &frame );
IHTMLDocument2Ptr docPtr( frame );
IHTMLWindow2 *pWindow;
docPtr->get_parentWindow( &pWindow );
IDispatchExPtr wndExPtr( pWindow );
IDispatchEx *pWndEx;
DISPID dispid;
wndExPtr->GetDispID( "TickerToolbar", fdexNameEnsure, &dispid);
DISPPARAMS dispparamsNoArgs = {NULL, NULL, 0, 0};
pWndEx->InvokeEx( dispid, LOCALE_USER_DEFAULT , DISPATCH_PROPERTYPUTREF,
this , NULL , NULL , NULL );
break;
}
//////////////////////////
//////////
//////////
//////////
//////////
/
I can send anybody a sample VC6 project that creates an IE Toolbar and has this compile error.
The compile errors I get are as follows:
C:\expando\CTBImplCOM.Cpp(
501) : error C2027: use of undefined type 'IDispatchEx'
C:\Program Files\Microsoft SDK\Include\comdef.h(476) : see declaration of 'IDispatchEx'
C:\expando\CTBImplCOM.Cpp(
501) : error C2039: 'GetDispID' : is not a member of '_com_ptr_t<class _com_IIID<struct IDispatchEx,&struct __s_GUID _GUID_a6ef9860_c720_11d0_9
337_00a0c9
0dcaa9> >'
C:\expando\CTBImplCOM.Cpp(
501) : error C2065: 'fdexNameEnsure' : undeclared identifier
C:\expando\CTBImplCOM.Cpp(
504) : error C2027: use of undefined type 'IDispatchEx'
C:\Program Files\Microsoft SDK\Include\comdef.h(476) : see declaration of 'IDispatchEx'
C:\expando\CTBImplCOM.Cpp(
504) : error C2227: left of '->InvokeEx' must point to class/struct/union
It seems that the declaration of IDispatchEx *pWndEx; is OK since the compiler doesn't complain there.
So IDispatchEx is included in a header file.
But when I used it at wndExPtr->GetDispID( it says it is an undefined type.
Help! I'm assume this is an easy problem but I can't see it.
Thanks
David Brooks