本文整理汇总了C++中IADs::get_Parent方法的典型用法代码示例。如果您正苦于以下问题:C++ IADs::get_Parent方法的具体用法?C++ IADs::get_Parent怎么用?C++ IADs::get_Parent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IADs
的用法示例。
在下文中一共展示了IADs::get_Parent方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PyIADs_getattro
PyObject* PyIADs_getattro(PyObject *ob, PyObject *obname)
{
char *name = PYWIN_ATTR_CONVERT(obname);
if (!name) return NULL;
IADs *p = PyIADs::GetI(ob);
// These are all BSTR values
BSTR ret = NULL;
HRESULT hr;
BOOL bad = FALSE;
Py_BEGIN_ALLOW_THREADS
// docs refer to 'property' as AdsPath, but function is ADsPath
// allow both
// @prop <o PyUnicode>|ADsPath|
// @prop <o PyUnicode>|AdsPath|Synonym for ADsPath
if (strcmp(name, "AdsPath")==0 || strcmp(name, "ADsPath")==0)
hr = p->get_ADsPath(&ret);
// @prop <o PyUnicode>|Class|
else if (strcmp(name, "Class")==0)
hr = p->get_Class(&ret);
// @prop <o PyUnicode>|GUID|Like the IADs method, this returns a string rather than a GUID object.
else if (strcmp(name, "GUID")==0)
hr = p->get_GUID(&ret);
// @prop <o PyUnicode>|Name|
else if (strcmp(name, "Name")==0)
hr = p->get_Name(&ret);
// @prop <o PyUnicode>|Parent|
else if (strcmp(name, "Parent")==0)
hr = p->get_Parent(&ret);
// @prop <o PyUnicode>|Schema|
else if (strcmp(name, "Schema")==0)
hr = p->get_Schema(&ret);
else
bad = TRUE;
Py_END_ALLOW_THREADS
if (bad)
return PyIBase::getattro(ob, obname);
if (FAILED(hr))
return PyCom_BuildPyException(hr, p, IID_IADs );
PyObject *rc = MakeBstrToObj(ret);
SysFreeString(ret);
return rc;
}
示例2: OnSchemaPath
void CDlgIADs::OnSchemaPath()
{
HRESULT hr;
UpdateData(TRUE); // Retrieve from UI
USES_CONVERSION;
IUnknown *pUnk;
IADs *pADs;
BSTR bstr;
CWaitCursor wait;
hr = App->ADsOpenObject( T2OLE( m_sSchema ), IID_IADs, (void**) &pADs );
RETURN_ON_FAILURE(hr);
hr = pADs->get_Parent( &bstr );
pADs->Release();
RETURN_ON_FAILURE(hr);
hr = App->ADsOpenObject( bstr, IID_IUnknown, (void**) &pUnk );
SysFreeString( bstr );
/////////////////////////////////////
// Bring up the IADsContainer Dialog
///////////////////////////////////////
if ( SUCCEEDED(hr) )
{
pUnk->AddRef();
CDlgIADsContainer dlg( pUnk, this );
dlg.DoModal();
pUnk->Release();
}
}