UINT GetControlCommand(IDispatch* pControl) { IRibbonControlPtr control; pControl->QueryInterface(__uuidof(IRibbonControl), (void**)&control); CComBSTR tag; if (FAILED(control->get_Tag(&tag))) return S_OK; return StrToInt(tag); }
CString GetControlId(IDispatch* pControl) { IRibbonControlPtr control; pControl->QueryInterface(__uuidof(IRibbonControl), (void**)&control); CComBSTR bstr_control_id; if (FAILED(control->get_Tag(&bstr_control_id))) return S_OK; return static_cast<LPCWSTR>(bstr_control_id); }