I'm trying to fire the onchange event for a SelectBox on a webpage (IE
6.0), the selectbox is automatically selected and filled through the
below code, however I cannot get the event to fire, is anyone able to
help out with this?
// This code works, as it selects the correct value in the drop down
pSelectElement->put_value(value);
VARIANT v_event;
v_event.vt = VT_DISPATCH;
hResult = pSelectElement->get_onchange(&v_event);
if(FAILED(hResult))
asm nop // for debugging
IDispatch *pDispatch = v_event.pdispVal;
unsigned int iVal = 0;
hResult = pDispatch->GetTypeInfoCount(&iVal);
if(FAILED(hResult))
asm nop
// iVal is 1 now
/*ITypeInfo FAR* pTypeInfo;
hResult = pDispatch->GetTypeInfo(0, LOCALE_USER_DEFAULT, &pTypeInfo);
if(FAILED(hResult))
asm nop*/
wchar_t *callName = L"onChange"; // name of the function
DISPID methodID;
hResult = pDispatch->GetIDsOfNames(IID_NULL, &callName, 1,
LOCALE_USER_DEFAULT, &methodID);
// this returns -1 in methodID, and a huge negative value in hResult
if(FAILED(hResult))
asm nop
If anyone can help me out here, or has a better solution for firing the
onChange event (or any events for that matter) it would be greatly
appreciated if you could let me know.
Cheers,
Ryan Thomas
TransActive Systems
ryan at transactive dot com dot au