HRESULT hr = pDisp->GetIDsOfNames( IID_NULL, &name, 1, LOCALE_SYSTEM_DEFAULT, &id );
if ( SUCCEEDED( hr ) ) {
VariantInit( dest );
VariantClear( dest );
DISPPARAMS dp = { 0, 0, 0, 0 };
hr = pDisp->Invoke( id, IID_NULL, LOCALE_SYSTEM_DEFAULT, DISPATCH_PROPERTYGET, &dp, dest, NULL, NULL );
if ( SUCCEEDED( hr ) ) {
return true;
} else {
LOG( _T( "failed to get var contents, hresult = 0x%lx" ), hr );
}
} else {
LOG( _T( "failed to get id of var name, hresult = 0x%lx" ), hr );
}
return false;
}
where pDisp has been retrieved using document->get_Script( &pDisp );.
This code works fine in previous versions of IE, on Windows XP, Vista and 7. In IE9 the script executes (I can invoke alerts, etc.), but the variable can not be read. What change in IE9 causes this problem?
上一页 [1] [2]