Basically I want to develop a BHO that validates certain fields on a form and auto-places disposable e-mails in the appropriate fields (more for my own knowledge). So in the DOCUMENTCOMPLETE event I have this:
for(long i = 0; i < *len; i++)
{
VARIANT* name = new VARIANT();
name->vt = VT_I4;
name->intVal = i;
VARIANT* id = new VARIANT();
id->vt = VT_I4;
id->intVal = 0;
IDispatch* disp = 0;
IHTMLFormElement* form = 0;
HRESULT r = forms->item(*name,*id,&disp);
if(S_OK != r)
{
MessageBox(0,L"Failed to get form dispatch",L"",0);// debug only
continue;
}
disp->QueryInterface(IID_IHTMLFormElement2,(void**)&form);
if(form == 0)
{
MessageBox(0,L"Failed to get form element from dispatch",L"",0);// debug only
continue;
}
// Code to listen for onsubmit events here...
}
How would I use the IHTMLFormElement interface to listen for the onsubmit event?