当前位置: 首页>>代码示例>>C++>>正文


C++ IADs::get_Name方法代码示例

本文整理汇总了C++中IADs::get_Name方法的典型用法代码示例。如果您正苦于以下问题:C++ IADs::get_Name方法的具体用法?C++ IADs::get_Name怎么用?C++ IADs::get_Name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IADs的用法示例。


在下文中一共展示了IADs::get_Name方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: PrintAllObjects

HRESULT PrintAllObjects(IADsContainer* pContainer)
{
    HRESULT hr;
     
    if(NULL == pContainer) 
    {
        return E_INVALIDARG;
    }
     
    IEnumVARIANT *pEnum = NULL;

    // Create an enumerator object in the container.
    hr = ADsBuildEnumerator(pContainer, &pEnum);
    if(SUCCEEDED(hr))
    {
        VARIANT var;
        ULONG ulFetched = 0L;

        // Get the next contained object.
        while(S_OK == (hr = ADsEnumerateNext(pEnum, 1, &var, &ulFetched)) && (ulFetched > 0))
        {
            IADs *pADs;

            // Print the object
            hr = V_DISPATCH(&var)->QueryInterface(IID_IADs, (void**)&pADs);
            if(SUCCEEDED(hr))
            {
                CComBSTR sbstr;
                IADsContainer *pChildContainer;

                hr = pADs->get_Name(&sbstr);
                if(SUCCEEDED(hr))
                {
                    wprintf(sbstr);
                    wprintf(L"\n");
                }

                hr = pADs->QueryInterface(IID_IADsContainer, (void**)&pChildContainer);
                if(SUCCEEDED(hr))
                {
                    // If the retrieved object is a container, recursively print its contents as well.
                    PrintAllObjects(pChildContainer);
                }
                
                pADs->Release();
            }
            
            // Release the VARIANT.
            VariantClear(&var);
        }
        
        ADsFreeEnumerator(pEnum);
    }

    return hr;
}
开发者ID:cpm2710,项目名称:cellbank,代码行数:56,代码来源:HelperUtilTest.cpp

示例2: 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;
}
开发者ID:malrsrch,项目名称:pywin32,代码行数:44,代码来源:PyIADs.cpp


注:本文中的IADs::get_Name方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。