Board index » cppbuilder » TEventDispatcher:: Is it possible to use this to intercept events generated by IHTMLTableRow?

TEventDispatcher:: Is it possible to use this to intercept events generated by IHTMLTableRow?


2005-09-24 06:12:56 AM
cppbuilder80
Hello,
If I want to connect to an HTMLTableRow object using a derived
TEventDispatcher, what event DispInterface would I need to use?
Steps I've tried; without sucess:
1. I'm able to get a valid pointer to an HTMLTableRow interface.
2. From this I'm able to retrieve a valid pointer to its HTMLElement
interface.
3. I try connecting a TEventDispatcher (based on DIID_HTMLElementEvents)
to the HTMLElement interface,
but I receive an E_NOINTERFACE(0x80004002) error.
I've been able to use TEventDispatcher (based on DIID_HTMLDocumentEvents2)
to connect to IHTMLDocument2 interface and
intercept document level events. I used this as a model in trying to
intercept events gererated by HTMLTableRow objects.
Thanks for any assistance.
James OBrien
//******************************************
//Derived TEventDispatcher defined below
//******************************************
class TBL_EventHandler: public TEventDispatcher<TBL_EventHandler,
&DIID_HTMLElementEvents>
{
private:
IHTMLElement *server;
TObject *MainObj;
bool connected;
protected:
//overloaded from TEventDispatcher.
HRESULT InvokeEvent(DISPID id, TVariant *params);
public:
TBL_EventHandler();
~TBL_EventHandler();
void Connect(TObject *Dest, IHTMLElement *srv);
void Disconnect();
bool Connected();
void __fastcall HandleEvents(DISPID id, TVariant *params);
};
//******************************************
//Method for connecting to IHTMLElement interface
//******************************************
void TBL_EventHandler::Connect(TObject *Dest, IHTMLElement *srv)
{
HRESULT hResult;
server = srv;
if(server){
MainObj = Dest;
hResult = ConnectEvents(server);
if( hResult == S_OK ){
server->AddRef();
connected = true;
}
else
server=NULL;
}
}
 
 

Re:TEventDispatcher:: Is it possible to use this to intercept events generated by IHTMLTableRow?

"James O'Brien" < XXXX@XXXXX.COM >wrote in message
Quote
3. I try connecting a TEventDispatcher (based on DIID_HTMLElementEvents)
to the HTMLElement interface, but I receive an E_NOINTERFACE(0x80004002)
error.
Some elements expose events via DIID_HTMLElementEvents, but many do not.
Most elements have their own specialized event interfaces. For example, IMG
elements use IHTMLImgElementEvents, TR elements use
IHTMLControlElementEvents, INPUT type fields use
IHTMLInputTextElementEvents, etc. Have a look at the following discussion
for more details:
groups.google.com/group/borland.public.cppbuilder.vcl.components.using/browse_thread/thread/5357f7784274e12f/df78082dce988f1f
The various event interfaces are listed here:
MSHTML Event DispInterfaces
msdn.microsoft.com/workshop/browser/mshtml/reference/events/events.asp
Gambit