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


C++ COleVariant::Clear方法代码示例

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


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

示例1: GetRegistryValue

int CTriasVMD::GetRegistryValue( LPCTSTR lpszKeyValue, COleVariant& val )
{


	CString	strKey;
//	strKey.Format( g_cbVMCfgKey, GetProgIdent() );
	strKey.Format( g_cbVMCfgKey, REG_COMPANY_KEY,REG_PRODUCT_KEY,GetProgIdent() );

	val.Clear();
	HKEY	hKey;
	DWORD	dwType;
	if( ERROR_SUCCESS == ::RegOpenKeyEx( HKEY_CURRENT_USER, strKey, 0L, KEY_READ, &hKey ) )
	{
		TCHAR	szBuffer[256];
		ULONG	lSize = sizeof( szBuffer ) / sizeof( *szBuffer );
		if( ERROR_SUCCESS == ::RegQueryValueEx( hKey, lpszKeyValue, 0L, &dwType, (BYTE*) szBuffer, &lSize ) )
		{
			switch( dwType )
			{
			case REG_DWORD :
				val = *(long*) szBuffer;
				break;
			case REG_SZ :
				val = (LPCTSTR) szBuffer;
				break;
			default :
				dwType = REG_NONE;
			}
		}
		else
			dwType = REG_NONE;
		::RegCloseKey( hKey );
	}
	return dwType;
}
开发者ID:hkaiser,项目名称:TRiAS,代码行数:35,代码来源:vmdreg.cpp

示例2: FillList

// FillList
// Called when a new Target Object Property is Set
// Iterates through the property map and adds the items to the
// List Control
void CPropMapCtrl::FillList()
{
	// REVIEW: handle Security Checking when that stuff is done

	if (!m_pPropMap)
	{
		// if the thing is null it means that the list should be emptied
		ClearList();
		return;
	}

	HRESULT hr = S_OK;
	CString cstrName;
	BSTR bstrReturnValue = NULL;

	// yes, iterate through properties
	VARIANT_BOOL fLastItem = VARIANT_FALSE;
	COleVariant varProperty;

	hr = m_pPropMap->get_IsEmpty( &fLastItem );
	if (FAILED(hr)) goto failexit;

	if( ! fLastItem )
	{
		varProperty.Clear();
		
		hr = m_pPropMap->FirstItem( &bstrReturnValue, &varProperty, &fLastItem );
		if (NONSECURITYFAIL(hr))
			goto failexit;

		while( !(fLastItem == VARIANT_TRUE))
		{
			// Get the name of the Item in the PropertyMap.
			cstrName = bstrReturnValue;

			if (SUCCEEDED(hr))
				AddVariantItem( varProperty, cstrName );

			SAFEFREESTRING(bstrReturnValue);

			hr = m_pPropMap->NextItem( &bstrReturnValue, &varProperty, &fLastItem );
			if (NONSECURITYFAIL(hr))
				goto failexit;
		}
	}

	m_listCtrl.Sort();

failexit:
	SAFEFREESTRING(bstrReturnValue);
}
开发者ID:opensim4opencog,项目名称:PrologVirtualWorlds,代码行数:55,代码来源:pmapctl.cpp

示例3:


//.........这里部分代码省略.........
		{
			hr = m_pSelectionList->FirstItem( &bstrReturnValue, &varProperty, &fLastItem );
			if( FAILED(hr) ) goto EXIT_FAIL;

			while( VARIANT_FALSE == fLastItem ) 
			{
				SAFEFREESTRING(bstrReturnValue);
				ThingPtr = varProperty;

				if (ThingPtr != NULL)
				{
					COleVariant			var; // get the geometry property
					CComBSTR			bstrType;

					SAFERELEASE(m_pWorld);
					hr = ThingPtr->get_World(&m_pWorld);
					if(FAILED(hr) || !m_pWorld) 	goto EXIT_FAIL;

					//Create our event vector if we don't have one already.
					if (!m_pVector)
					{
						hr = m_pWorld->CreateObjectPropertyExt(CLSID_Vector, NULL, (IObjectProperty**) &m_pVector);
						if (FAILED(hr)) goto EXIT_FAIL;
					}

					hr = ThingPtr->get_ObjectProperty(bstrScale, (IObjectProperty**)&pvPos);
					if (FAILED(hr)) goto EXIT_FAIL;

					hr = pvPos->get(&fPosx, &fPosy, &fPosz);
					if (FAILED(hr)) goto EXIT_FAIL;
					SAFERELEASE(pvPos);

					if (FAILED(hr = ThingPtr->CheckPropertySecurityExt(bstrScale, PS_WRITE)))
					{
						goto SECURITY_ERROR;
					}

					vbMoveable = VARIANT_TRUE;
					if (SUCCEEDED(hr = ThingPtr->get_BOOL(CComBSTR("IsMoveable"), &vbMoveable)) && !vbMoveable)
					{
						goto SECURITY_ERROR;
					}

					if (FAILED(hr = ThingPtr->get_Type(&bstrType.m_str)) || CompareElements(&bstrAvatar.m_str, &bstrType.m_str))
					{
						goto SECURITY_ERROR;
					}

					hr = ThingPtr->InvokeMethodExt(CComBSTR("GetFrame"), NULL, &var);
					if (FAILED(hr)) goto EXIT_FAIL;

					TransPtr = var;
					if( TransPtr != NULL )
					// At least one selected item has an IVWTransform
					{
						hr = TransPtr->QueryInterface(IID_IVWFrame, (void **) &pVWFrame);
						if (SUCCEEDED(hr) && pVWFrame != NULL)
						{
							hr = pVWFrame->GetParent(&pVWParentFrame);
							if (SUCCEEDED(hr) && pVWParentFrame != NULL)
							{
								*pfValid = VARIANT_TRUE;
								POSITION pos = m_TransformList.AddTail( pTmpTransObj = new CTranslate3DObject( ThingPtr, TransPtr, pVWFrame ) );

								pTmpTransObj->currentLocation.x = fPosx;
								pTmpTransObj->currentLocation.y = fPosy;
								pTmpTransObj->currentLocation.z = fPosz;
							}
		    				if( FAILED(hr) ) goto EXIT_FAIL;
							SAFERELEASE(pVWParentFrame);
						}
	    				if( FAILED(hr) ) goto EXIT_FAIL;
						SAFERELEASE(pVWFrame);
					}
SECURITY_ERROR:
					SAFERELEASE(pvPos);
					var.Clear();
				}
				varProperty.Clear();
				hr = m_pSelectionList->NextItem( &bstrReturnValue, &varProperty, &fLastItem );
    			if( FAILED(hr) ) goto EXIT_FAIL;
			}
		}  
	}
	goto EXIT_SUCCEED;
EXIT_FAIL:
	if (!m_TransformList.IsEmpty())
		DeletePtrListElements(&m_TransformList);

	*pfValid = FALSE;

EXIT_SUCCEED:
	SAFERELEASE(pvPos);
	SAFEFREESTRING(bstrReturnValue);
	SAFERELEASE(pVWFrame);
	SAFERELEASE(pVWParentFrame);

	return hr;

}
开发者ID:opensim4opencog,项目名称:PrologVirtualWorlds,代码行数:101,代码来源:scaletl.cpp

示例4: Default

// Default implementation for RFX functions
void CDaoFieldExchange::Default(LPCTSTR lpszName, void* pv,
	DWORD dwColumnType, DWORD dwBindOptions)
{
	switch (m_nOperation)
	{
	case AddToParameterList:
		if (m_nParam != 1)
			m_prs->m_strSQL += ",";
		m_prs->m_strSQL += lpszName;
		AppendParamType(m_prs->m_strSQL, dwColumnType);
		return;

	case AddToSelectList:
		if (m_nField != 1)
			m_prs->m_strSQL += ",";
		m_prs->m_strSQL += lpszName;
		return;

	case BindField:
		{
			// Query parser needs "[" & "]", GetRows can't tolerate them.
			LPTSTR lpszNoBracketName = new TCHAR[lstrlen(lpszName) + 1];
			m_prs->StripBrackets(lpszName, lpszNoBracketName);

			// Finish setting up column binding info struct
			LPDAOCOLUMNBINDING pcb =
				&m_prs->m_prgDaoColBindInfo[m_nField-1];
			pcb->cbInfoOffset =
				(DWORD)&m_prs->m_pulColumnLengths[m_nField-1];
#ifndef _UNICODE
			pcb->columnID.dwKind = DAOCOLKIND_STR;
			pcb->columnID.lpstr = lpszNoBracketName;
#else
			pcb->columnID.dwKind = DAOCOLKIND_WSTR;
			pcb->columnID.lpwstr = lpszNoBracketName;
#endif

			// Setup the field index map (and store value as void ptr)
			m_prs->m_pMapFieldIndex->SetAt(pv, (void*)m_nField);
		}
		return;

	case BindParam:
		{
			COleVariant* pvar = NULL;

			TRY
			{
				// NULL params not supported, use IS NULL in SQL
				// (i.e. - m_strFilter = _T("Foo IS NULL");
				FillVariant(pv, dwColumnType, &pvar);
				m_prs->m_pQueryDef->SetParamValue(lpszName, *pvar);
			}
			CATCH_ALL(e)
			{
				if (pvar != NULL)
					pvar->Clear();
				delete pvar;
				pvar = NULL;
				THROW_LAST();
			}
			END_CATCH_ALL

			pvar->Clear();
			delete pvar;
			pvar = NULL;
		}
		return;

	case Fixup:
		if (m_prs->GetFieldLength(m_nField-1) == DAO_NULL)
		{
			// Set the value to PSEUDO NULL and mark the status NULL
			SetNullValue(pv, dwColumnType);
			m_prs->SetNullFieldStatus(m_nField-1);
		}
		return;

	case AllocCache:
		if (dwBindOptions & AFX_DAO_ENABLE_FIELD_CACHE)
		{
			CDaoFieldCache* pCache;

			// Allocate new storage and add to map
			AllocCacheValue(pCache, dwColumnType);
			m_prs->m_pMapFieldCache->SetAt(pv, pCache);
		}
		return;

	case StoreField:
		if (dwBindOptions & AFX_DAO_ENABLE_FIELD_CACHE)
		{
			CDaoFieldCache* pCache = GetCacheValue(m_prs, pv);

			// Copy the data to the cache
			if (dwBindOptions & AFX_DAO_CACHE_BY_VALUE)
				CopyValue(pv, (void*)&pCache->m_pvData, dwColumnType);
			else
				CopyValue(pv, pCache->m_pvData, dwColumnType);
//.........这里部分代码省略.........
开发者ID:rickerliang,项目名称:OpenNT,代码行数:101,代码来源:daodfx.cpp

示例5: CRotateObject

// Temporary transform object:
// Only returns true if there is at least one selected object
// AND all selected objects have an IVWTransform.
STDMETHODIMP CRotate2DTool::IsValid(IVWUIView * pVw, VARIANT_BOOL * pfValid)
{
	HRESULT hr = S_OK;
	CVWPickDataPtr pickDataPtr;
	BSTR bstrReturnValue = NULL;
	VARIANT_BOOL	fLastItem = VARIANT_TRUE;
	COleVariant varProperty;
	::VariantInit( &varProperty);
	
	*pfValid = FALSE;
	
	ASSERT( pfValid );
	if (!pfValid )
	{
		hr = E_POINTER;
		goto EXIT_FAIL;
	}

	DestroyTransformList();

	if(	m_pSelectionList )
	{
		hr = m_pSelectionList->get_IsEmpty( &fLastItem  );
		if( FAILED(hr) )  goto EXIT_FAIL;
		if( VARIANT_FALSE == fLastItem ) {
			hr = m_pSelectionList->FirstItem( &bstrReturnValue, &varProperty, &fLastItem );
			if( FAILED(hr) ) goto EXIT_FAIL;
			while( VARIANT_FALSE == fLastItem ) 
			{
				SAFEFREESTRING(bstrReturnValue);

				pickDataPtr = varProperty;
				if( pickDataPtr != NULL )  
				// At least one selected item has an IVWPickData
				{
					CThingPtr ThingPtr;

					hr = pickDataPtr->get_Thing(&ThingPtr.p);
					if(FAILED(hr) || !ThingPtr.p) goto EXIT_FAIL;

					if (SUCCEEDED(hr = ThingPtr->CheckPropertySecurityExt(bstrBoundaryList, PS_WRITE)))
					{
						*pfValid = TRUE;
						POSITION pos = m_TransformList.AddTail( new CRotateObject(  pickDataPtr ) );
					}
					else
					{
						*pfValid = FALSE;
						goto EXIT_FAIL;
					}
				}
				//else
				// Found one without IVWTransform.
				//{
				//	*pfValid = FALSE;
				//	goto EXIT_FAIL;
				//}
				varProperty.Clear();
				hr = m_pSelectionList->NextItem( &bstrReturnValue, &varProperty, &fLastItem );
    			if( FAILED(hr) ) goto EXIT_FAIL;
			}
		}  // if( VARIANT_FALSE == fLastItem )
	}
	goto EXIT_SUCCEED;
EXIT_FAIL:
	DestroyTransformList();

EXIT_SUCCEED:
	SAFEFREESTRING(bstrReturnValue);
	return hr;
}
开发者ID:opensim4opencog,项目名称:PrologVirtualWorlds,代码行数:74,代码来源:rotat2d.cpp


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