本文整理汇总了C++中CComPtr::AddPropertyExt方法的典型用法代码示例。如果您正苦于以下问题:C++ CComPtr::AddPropertyExt方法的具体用法?C++ CComPtr::AddPropertyExt怎么用?C++ CComPtr::AddPropertyExt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CComPtr
的用法示例。
在下文中一共展示了CComPtr::AddPropertyExt方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TMchInstall
HRESULT CFoundationExemplars::TMchInstall(IModule* pModule)
{
// Array of methods for transaction machine
CMethodInfo rgMethod[] =
{
{ METHOD_SERVER, "OnCreate", "TMchOnCreate", PSBIT_NONE, PS_EXEMPLARDEFAULTMETHOD },
{ METHOD_CLIENT, "UpdateCurrentIndex", "TMchUpdateCurrentIndex", PSBIT_NONE, PS_ALLEXECUTEMETHOD },
{ METHOD_CLIENT, "SetCurrentIndex", "TMchSetCurrentIndex", PSBIT_NONE, PS_ALLEXECUTEMETHOD },
{ METHOD_CLIENT, "OnCurrentIndexChanged", "TMchOnCurrentIndexChanged", PSBIT_NONE, PS_ALLEXECUTEMETHOD },
{ METHOD_CLIENT, "GetCurrentItem", "TMchGetCurrentItem", PSBIT_NONE, PS_ALLEXECUTEMETHOD },
{ METHOD_SERVER, "CreateAndDispenseObject", "TMchCreateAndDispenseObject", PSBIT_NONE, PS_ALLEXECUTEMETHOD }
};
int cMethod = sizeof(rgMethod)/sizeof(rgMethod[0]);
int iMethod;
HRESULT hr = S_OK;
CComPtr<IThing> pTransMachineEx;
CComPtr<IVector> pVector;
CComPtr<IPropertyList> pItemList;
CComPtr<IPropertyList> pMenu;
CComPtr<IPropertyList> pMenuEx;
CComPtr<IMenuItem> pMenuItem;
CComPtr<IThing> pPrevBtnEx;
CComPtr<IThing> pNextBtnEx;
CComPtr<IThing> pSelectBtnEx;
CComPtr<IThing> pDisplayEx;
CComBSTR bstrName;
CComBSTR bstrNameInternal;
static CComBSTR bstrGeometryName("GeometryName");
// Create the transaction machine exemplar
if (FAILED(hr = m_pWorld->CreateExemplarEx(CComBSTR("Transaction Machine Exemplar"),
CComBSTR("TransactionMachine"),
CComVariant(CComBSTR("Artifact")), &pTransMachineEx)))
goto ERROR_ENCOUNTERED;
// Set the description string
if (FAILED(hr = pTransMachineEx->put_Description(CComBSTR("A transaction machine which dispenses goods"))))
goto ERROR_ENCOUNTERED;
// Create a geometry for it
if (FAILED(hr = pTransMachineEx->put_String(bstrGeometryName, CComBSTR("Client/Exemplar/Vending/Hvend.x"))))
goto ERROR_ENCOUNTERED;
// Set contents (buttons, display) to be visible
if (FAILED(hr = pTransMachineEx->put_BOOL(CComBSTR("IsContentsVisible"), VARIANT_TRUE)))
goto ERROR_ENCOUNTERED;
// Add properties
if (FAILED(hr = pTransMachineEx->AddPropertyExt(CComBSTR("Display"),
CComVariant((IDispatch *) NULL),
PSBIT_EXEMPLARDEFAULTPROPERTY,
PS_EXEMPLARDEFAULTPROPERTY,
VT_DISPATCH, IID_IThing, NULL)))
goto ERROR_ENCOUNTERED;
if (FAILED(hr = pTransMachineEx->AddPropertyExt(CComBSTR("CurrentIndex"),
CComVariant((short) 0),
PSBIT_EXEMPLARDEFAULTPROPERTY,
PS_ALLACCESSPROPERTY,
VT_I2, IID_IDispatch, NULL)))
goto ERROR_ENCOUNTERED;
if (FAILED(hr = CreatePropertyList(m_pWorld, &pItemList)))
goto ERROR_ENCOUNTERED;
if (FAILED(hr = pTransMachineEx->AddPropertyExt(CComBSTR("ItemList"),
CComVariant((IDispatch *) pItemList),
PSBIT_EXEMPLARDEFAULTPROPERTY,
PS_EXEMPLARDEFAULTCOLLECTION,
VT_DISPATCH, IID_IPropertyList, NULL)))
goto ERROR_ENCOUNTERED;
pItemList.Release();
// Create "sub" exemplars with geometry for previous/next buttons, select button, & display
// Previous Button
if (FAILED(hr = m_pWorld->CreateExemplarEx(CComBSTR("Previous Button Exemplar"),
CComBSTR("PreviousButton"),
CComVariant(CComBSTR("Artifact")), &pPrevBtnEx)))
goto ERROR_ENCOUNTERED;
if (FAILED(hr = pPrevBtnEx->put_String(bstrGeometryName, CComBSTR("Client/Exemplar/Vending/VButLeft.x"))))
goto ERROR_ENCOUNTERED;
if (FAILED(hr = CreateVector(m_pWorld, 0.0, 0.0, 0.0, &pVector)))
goto ERROR_ENCOUNTERED;
if (FAILED(hr = pPrevBtnEx->put_ObjectProperty(CComBSTR("Position"), pVector)))
goto ERROR_ENCOUNTERED;
pVector.Release();
if (FAILED(hr = pPrevBtnEx->put_BOOL(CComBSTR("IsNoticeable"), VARIANT_TRUE)))
goto ERROR_ENCOUNTERED;
if (FAILED(hr = pPrevBtnEx->put_BOOL(CComBSTR("IsTakeable"), VARIANT_FALSE)))
goto ERROR_ENCOUNTERED;
if (FAILED(hr = pPrevBtnEx->CreateAndAddMethodExt(METHOD_CLIENT, pModule,
CComBSTR("TMchPreviousButton_OnLButtonDown"),
CComBSTR("OnLButtonDown"),
PSBIT_NONE, PS_ALLEXECUTEMETHOD)))
//.........这里部分代码省略.........