本文整理汇总了C++中ITypeInfo::GetIDsOfNames方法的典型用法代码示例。如果您正苦于以下问题:C++ ITypeInfo::GetIDsOfNames方法的具体用法?C++ ITypeInfo::GetIDsOfNames怎么用?C++ ITypeInfo::GetIDsOfNames使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITypeInfo
的用法示例。
在下文中一共展示了ITypeInfo::GetIDsOfNames方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetIDsOfNames
HRESULT CComTypeInfoHolder::GetIDsOfNames(REFIID /*riid*/, LPOLESTR* rgszNames,
UINT cNames, LCID lcid, DISPID* rgdispid)
{
ITypeInfo* pInfo;;
HRESULT hRes = GetTI(lcid, &pInfo);
return (pInfo != NULL) ?
pInfo->GetIDsOfNames(rgszNames, cNames, rgdispid) : hRes;
}
示例2:
STDMETHODIMP
InterfaceAdapter::GetIDsOfNames (
InterfaceAdapter *pThis,
REFIID,
OLECHAR **rgszNames,
UINT cNames,
LCID,
DISPID *rgDispId)
{
ITypeInfo *pTypeInfo = pThis->m_dispatchImpl.typeInfo();
return pTypeInfo->GetIDsOfNames(rgszNames, cNames, rgDispId);
}
示例3: GetTypeInfo
STDMETHODIMP
CBaseDispatch::GetIDsOfNames(
REFIID riid,
OLECHAR ** rgszNames,
UINT cNames,
LCID lcid,
DISPID * rgdispid)
{
// although the IDispatch riid is dead, we use this to pass from
// the interface implementation class to us the iid we are talking about.
ITypeInfo * pti;
HRESULT hr = GetTypeInfo(riid, 0, lcid, &pti);
if (SUCCEEDED(hr)) {
hr = pti->GetIDsOfNames(rgszNames, cNames, rgdispid);
pti->Release();
}
return hr;
}
示例4: PyCom_BuildPyException
// @pymethod int|PyITypeInfo|GetIDsOfNames|Maps between member names and member IDs, and parameter names and parameter IDs.
static PyObject *typeinfo_getidsofnames(PyObject *self, PyObject *args)
{
// XXX - todo - merge this code with PyIDispatch::GetIDsOfNames
ITypeInfo *pti = PyITypeInfo::GetI(self);
if (pti==NULL) return NULL;
UINT i;
int argc = PyTuple_GET_SIZE(args);
if ( argc < 1 ) {
PyErr_SetString(PyExc_TypeError, "At least one argument must be supplied");
return NULL;
}
LCID lcid = LOCALE_SYSTEM_DEFAULT;
UINT offset = 0;
if ( argc > 1 )
{
PyObject *ob = PyTuple_GET_ITEM(args, 0);
lcid=PyLong_AsLong(ob);
if (lcid==-1 && PyErr_Occurred()){
PyErr_Clear();
lcid=LOCALE_SYSTEM_DEFAULT;
}
else
offset = 1;
}
UINT cNames = argc - offset;
OLECHAR FAR* FAR* rgszNames = new LPOLESTR[cNames];
for ( i = 0 ; i < cNames; ++i )
{
PyObject *ob = PyTuple_GET_ITEM(args, i + offset);
if (!PyWinObject_AsBstr(ob, rgszNames+i)) {
for (;i>0;i--)
PyWinObject_FreeBstr(rgszNames[i-1]);
delete [] rgszNames;
return NULL;
}
}
DISPID FAR* rgdispid = new DISPID[cNames];
PY_INTERFACE_PRECALL;
HRESULT hr = pti->GetIDsOfNames(rgszNames, cNames, rgdispid);
PY_INTERFACE_POSTCALL;
for (i=0;i<cNames;i++)
PyWinObject_FreeBstr(rgszNames[i]);
delete [] rgszNames;
if ( FAILED(hr) ){
delete [] rgdispid;
return PyCom_BuildPyException(hr, pti, IID_ITypeInfo);
}
PyObject *result;
/* if we have just one name, then return a single DISPID (int) */
if ( cNames == 1 )
{
result = PyInt_FromLong(rgdispid[0]);
}
else
{
result = PyTuple_New(cNames);
if ( result )
{
for ( i = 0; i < cNames; ++i )
{
PyObject *ob = PyInt_FromLong(rgdispid[i]);
if ( !ob )
{
delete [] rgdispid;
return NULL;
}
PyTuple_SET_ITEM(result, i, ob);
}
}
}
delete [] rgdispid;
return result;
}