J
Jeff Mastry
I am writing a COM add-in for Word that does not #import the Office type
libraries (I am using AutoWrap instead:
http://support.microsoft.com/kb/q238393/).
Anyway, I am unable to QI a CommandBars collection to IEnumVARIANT:
===
HRESULT hr;
CComVariant result;
//-- Get the CommandBars collection
hr = AutoWrap( DISPATCH_PROPERTYGET, &result, m_word, L"CommandBars", 0 );
if( FAILED(hr) ) return hr;
CComQIPtr<IEnumVARIANT> p_enum = result.pdispVal; //p_enum = NULL
===
I have also tried accessing the Item property of CommandBars, but that gives
me a really useless error message: "An exception was thrown". Here's that
code:
===
HRESULT hr;
CComVariant result;
//-- Get the CommandBars collection
hr = AutoWrap( DISPATCH_PROPERTYGET, &result, m_word, L"CommandBars", 0 );
if( FAILED(hr) ) return hr;
CComPtr<IDispatch> p_bars = result.pdispval;
hr = AutoWrap( DISPATCH_PROPERTYGET, &result, p_bars, L"Item", 1, 3 );
===
Thanks,
Jeff
libraries (I am using AutoWrap instead:
http://support.microsoft.com/kb/q238393/).
Anyway, I am unable to QI a CommandBars collection to IEnumVARIANT:
===
HRESULT hr;
CComVariant result;
//-- Get the CommandBars collection
hr = AutoWrap( DISPATCH_PROPERTYGET, &result, m_word, L"CommandBars", 0 );
if( FAILED(hr) ) return hr;
CComQIPtr<IEnumVARIANT> p_enum = result.pdispVal; //p_enum = NULL
===
I have also tried accessing the Item property of CommandBars, but that gives
me a really useless error message: "An exception was thrown". Here's that
code:
===
HRESULT hr;
CComVariant result;
//-- Get the CommandBars collection
hr = AutoWrap( DISPATCH_PROPERTYGET, &result, m_word, L"CommandBars", 0 );
if( FAILED(hr) ) return hr;
CComPtr<IDispatch> p_bars = result.pdispval;
hr = AutoWrap( DISPATCH_PROPERTYGET, &result, p_bars, L"Item", 1, 3 );
===
Thanks,
Jeff