本文整理汇总了C++中CComQIPtr::CreateExtUserParamEnumerator方法的典型用法代码示例。如果您正苦于以下问题:C++ CComQIPtr::CreateExtUserParamEnumerator方法的具体用法?C++ CComQIPtr::CreateExtUserParamEnumerator怎么用?C++ CComQIPtr::CreateExtUserParamEnumerator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CComQIPtr
的用法示例。
在下文中一共展示了CComQIPtr::CreateExtUserParamEnumerator方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InitPropGSDModule
//----------------------------- FUNCTION -------------------------------------*
HRESULT CSheetConfigGSD::InitPropGSDModule()
{
HRESULT hr;
VARIANT vtVal;
long lVal;
IUnknown * pUnknown = NULL;
CComQIPtr<IDP_Slave, &IID_IDP_Slave> pSlave;
pSlave = m_pUnknown;
if (!pSlave) {
return E_NOINTERFACE;
}
//get the User_Prm_Data first.
hr = pSlave->get_LenUserParams(&lVal);
if(FAILED(hr)) {
return hr;
}
m_pModuleSpec->SetUserPrmLen(lVal);
if(lVal) { // > 0
::VariantInit(&vtVal);
hr = pSlave->get_UserPrmData(&vtVal);
if (FAILED(hr)) {
return hr;
}
//and set the data to the property page
m_pModuleSpec->SetUserPrmData(vtVal);
}
//if Ext_User_Prm_Data_Const/Ref is available "or" it into the
//m_DefaultUserPrmData by calling AddDefaultUserPrmData()
//be careful: flag has to be set prior to calling this method
if(m_bHasExtUserPrm) { //ext user params
hr = pSlave->CreateExtUserParamEnumerator(&pUnknown);
if (SUCCEEDED(hr))
{
CComQIPtr<IEnumUnknown, &IID_IEnumUnknown> pEnum;
pEnum = pUnknown;
pUnknown->Release();
if (pEnum == NULL) {
return E_NOINTERFACE;
}
ULONG ulFetched = 0;
IUnknown *pUnk = NULL;
HRESULT hr = S_FALSE;
// enumerate thru ext user params!
while (pEnum->Next(1, &pUnk, &ulFetched) == S_OK)
{
CComQIPtr<IExtUserParam, &IID_IExtUserParam> pParam;
pParam = pUnk;
pUnk->Release();
if (pParam)
{
ExtParam* pExtParam = new ExtParam();
GetExtUserParams(pParam, pExtParam);
m_pModuleSpec->AddExtUserParam(pExtParam);
m_pModuleSpec->AddDefaultUserPrmData(pExtParam);
}
}
}
}
return S_OK;
}
示例2: InitPropSlaveModules
//----------------------------- FUNCTION -------------------------------------*
BOOL CSheetConfigGSD::InitPropSlaveModules()
{
HRESULT hr;
LONG lValue;
// BOOL bValue;
LPUNKNOWN pUnknown = NULL;
// is it a DP-Slave?
CComQIPtr<IDP_Slave, &IID_IDP_Slave> pSlave;
pSlave = m_pUnknown;
if (pSlave)
{
m_pSlaveModule->SetModularType(m_bIsModular);
if (m_bIsModular) {
hr = pSlave->get_MaxModule(&lValue);
if (SUCCEEDED(hr)) {
m_pSlaveModule->SetMaxModule(lValue);
}
hr = pSlave->get_MaxInputLen(&lValue);
if (SUCCEEDED(hr)) {
m_pSlaveModule->SetMaxInputLen(lValue);
}
hr = pSlave->get_MaxOutputLen(&lValue);
if (SUCCEEDED(hr)) {
m_pSlaveModule->SetMaxOutputLen(lValue);
}
hr = pSlave->get_MaxDataLen(&lValue);
if (SUCCEEDED(hr)) {
m_pSlaveModule->SetMaxDataLen(lValue);
}
}
else {
m_pSlaveModule->SetMaxModule(0x7FFFFFFF);
m_pSlaveModule->SetMaxInputLen(0);
m_pSlaveModule->SetMaxOutputLen(0);
m_pSlaveModule->SetMaxDataLen(0);
}
BSTR sName = NULL;
CComQIPtr<IEnumUnknown, &IID_IEnumUnknown> pEnumModules;
int modid = 0;
hr = pSlave->CreateModuleEnumerator(&pUnknown);
if (SUCCEEDED(hr))
{
pEnumModules = pUnknown;
pUnknown->Release();
if (pEnumModules)
{
ULONG ulFetched = 0;
// enumerate thru modules!
while(pEnumModules->Next(1, &pUnknown, &ulFetched) == S_OK)
{
CComQIPtr<IModule, &IID_IModule> pModule;
pModule = pUnknown;
pUnknown->Release();
if (pModule)
{
// print module data
hr = pModule->get_ModName(&sName);
if (SUCCEEDED(hr)) {
CDP_Module* pNewModule = new CDP_Module(modid++);
pNewModule->SetModuleName(sName);
LONG lVal;
if (SUCCEEDED(pModule->get_LenUserParams(&lVal)))
pNewModule->SetUserPrmLen(lVal);
GetAndSaveConfigBytes(pModule, pNewModule);
m_pSlaveModule->AddNewModule(pNewModule);
::SysFreeString(sName);
BOOL bHasExtUserParam = FALSE;
hr = pModule->get_HasExtUserParam(&bHasExtUserParam);
if (SUCCEEDED(hr) && bHasExtUserParam) {
hr = pModule->CreateExtUserParamEnumerator(&pUnknown);
if (SUCCEEDED(hr))
{
CComQIPtr<IEnumUnknown, &IID_IEnumUnknown> pEnum;
pEnum = pUnknown;
pUnknown->Release();
if (pEnum == NULL) {
return E_NOINTERFACE;
}
ULONG ulFetched = 0;
IUnknown* pUnk = NULL;
HRESULT hr = S_FALSE;
// enumerate thru ext user params!
while (pEnum->Next(1, &pUnk, &ulFetched) == S_OK)
{
CComQIPtr<IExtUserParam, &IID_IExtUserParam> pParam;
pParam = pUnk;
pUnk->Release();
if (pParam)
{
ExtParam* pExtParam = new ExtParam();
GetExtUserParams(pParam, pExtParam);
pNewModule->AddExtParamDef(pExtParam);
}
}
}
//.........这里部分代码省略.........