本文整理汇总了C++中LPDISPATCH::GetIDsOfNames方法的典型用法代码示例。如果您正苦于以下问题:C++ LPDISPATCH::GetIDsOfNames方法的具体用法?C++ LPDISPATCH::GetIDsOfNames怎么用?C++ LPDISPATCH::GetIDsOfNames使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LPDISPATCH
的用法示例。
在下文中一共展示了LPDISPATCH::GetIDsOfNames方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnActivate
void CNetscapeCntrItem::OnActivate()
{
char * pSource = NULL;
const char* ptr;
LPDISPATCH pdisp;
HRESULT hr;
int _convert;
if (m_lpObject->QueryInterface(IID_IDispatch, (void**)&pdisp) == S_OK){
#ifdef XP_WIN32
LPCOLESTR lpOleStr = T2COLE("SaveAs");
hr = pdisp->GetIDsOfNames(IID_NULL, (unsigned short **)&lpOleStr, 1, LOCALE_USER_DEFAULT, &m_idSavedAs);
pdisp->Release();
if (hr == S_OK)
m_bCanSavedByOLE = TRUE;
else
m_idSavedAs = DISPID_UNKNOWN;
#else
m_idSavedAs = DISPID_UNKNOWN;
#endif
}
const char* ptr1 = m_csAddress;
if (NET_IsLocalFileURL((char*)ptr1)) {
XP_ConvertUrlToLocalFile(m_csAddress, &pSource);
m_csDosName = *pSource; // pick up the drive name.
m_csDosName += ":";
m_csDosName += strchr(pSource, '\\'); // pick up the real file name.
ptr = m_csDosName;
FE_ConvertSpace((char*)ptr);
XP_FREE(pSource);
}
// the object does not support ole automation, try to find out if this is a storagefile, so
// we can use OLESave().
if (!m_bCanSavedByOLE) {
#ifdef XP_WIN32 // we will only want to handle saving when the object had storage file.
int _convert;
LPCOLESTR lpsz = A2CW(m_csDosName);
if (StgIsStorageFile(lpsz) == S_OK)
m_bCanSavedByOLE = TRUE;
#else
HRESULT sc1 = StgIsStorageFile(m_csDosName);
if (GetScode(sc1) == S_OK)
m_bCanSavedByOLE = TRUE;
#endif
}
CGenericView* pView = GetActiveView();
CFrameGlue *pFrameGlue = pView->GetFrame();
if(pFrameGlue != NULL) {
m_bLocationBarShowing = pFrameGlue->GetChrome()->GetToolbarVisible(ID_LOCATION_TOOLBAR);
}
COleClientItem::OnActivate();
}
示例2: AutoDispInvoke
HRESULT WSAccessor::AutoDispInvoke(LPDISPATCH pdisp, LPOLESTR pwszname, DISPID dspid,
WORD wflags, DWORD cargs, VARIANT* rgargs, VARIANT* pvtret)
{
HRESULT hr;
DISPID dspidPut = DISPID_PROPERTYPUT;
DISPPARAMS dspparm = {NULL, NULL, 0, 0};
CHECK_NULL_RETURN(pdisp, E_POINTER);
dspparm.rgvarg = rgargs;
dspparm.cArgs = cargs;
if ((wflags & DISPATCH_PROPERTYPUT) || (wflags & DISPATCH_PROPERTYPUTREF))
{
dspparm.rgdispidNamedArgs = &dspidPut;
dspparm.cNamedArgs = 1;
}
try
{
if (pwszname)
{
hr = pdisp->GetIDsOfNames(IID_NULL, &pwszname, 1, LOCALE_USER_DEFAULT, &dspid);
//RETURN_ON_FAILURE(hr);
if( FAILED(hr))
{
*(_variant_t*)pvtret = L"方法名获取失败,可能拼写错误!";
return hr;
}
}
hr = pdisp->Invoke(dspid, IID_NULL, LOCALE_USER_DEFAULT,
(WORD)(DISPATCH_METHOD | wflags), &dspparm, pvtret, NULL, NULL);
}
catch(...)
{
hr = S_FALSE;
}
return hr;
}
示例3: GetOutlookApp
HRESULT CMyAddin::GetOutlookApp(IExchExtCallback *pmecb,
Outlook::_ApplicationPtr &rOLAppPtr)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
try
{
IOutlookExtCallback *pOutlook = NULL;
HRESULT hRes = pmecb->QueryInterface(IID_IOutlookExtCallback,(void **) &pOutlook);
if (pOutlook)
{
IUnknown *pUnk = NULL;
pOutlook->GetObject(&pUnk);
LPDISPATCH lpMyDispatch;
if (pUnk != NULL)
{
hRes = pUnk->QueryInterface(IID_IDispatch, (void **) &lpMyDispatch);
pUnk->Release();
}
if (lpMyDispatch)
{
OLECHAR * szApplication = L"Application";
DISPPARAMS dispparamsNoArgs = {NULL, NULL, 0, 0};
DISPID dspid;
VARIANT vtResult;
lpMyDispatch->GetIDsOfNames(IID_NULL, &szApplication, 1, LOCALE_SYSTEM_DEFAULT, &dspid);
lpMyDispatch->Invoke(dspid, IID_NULL, LOCALE_SYSTEM_DEFAULT, DISPATCH_METHOD, &dispparamsNoArgs, &vtResult, NULL, NULL);
lpMyDispatch->Release();
rOLAppPtr= vtResult.pdispVal;
return S_OK;
}
}
}
catch(...)
{
}
return S_FALSE;
}
示例4: AddElement
void CElementPropPage::AddElement()
{
// Needed for Unicode conversion functions
USES_CONVERSION;
// Get the dispatch of the control
LPDISPATCH lpControl = GetControlDispatch();
// Update the control using automation calls
COleDispatchDriver PropDispDriver;
DISPID dwDispID;
// Get a Unicode string
LPCOLESTR lpOleStr = T2COLE(L"AddElement" );
if (SUCCEEDED( lpControl->GetIDsOfNames(IID_NULL, (LPOLESTR*)&lpOleStr,
1, 0, &dwDispID)))
{
PropDispDriver.AttachDispatch( lpControl, FALSE);
PropDispDriver.InvokeHelper( dwDispID, DISPATCH_METHOD, VT_EMPTY, NULL, NULL);
PropDispDriver.DetachDispatch();
}
}