Exemple #1
0
void Grid::move(const OSG::Matrix& xform)
{
#if OSG_MAJOR_VERSION < 2
   OSG::CPEditor rce(mRoot.core(), OSG::Transform::MatrixFieldMask);
#endif
   mRoot->setMatrix(xform);
}
// for WinNT we need to delete recursively ourselves
HRESULT RegistryClass::DeleteKey (LPCTSTR pszKey, const BOOL fRecursive)
{
	if ((NULL == m_hKey) || IsEmptyStr(pszKey))
		return ERROR_BAD_ARGUMENTS;

	if (fRecursive)
	{
		RegistryClass	rsk;
		HRESULT			hr=rsk.SetBasedLocation(*this, pszKey, KEY_ALL_ACCESS, FALSE);
		if (hr != ERROR_SUCCESS)
			return hr;

		static const UINT32	AVG_SUBKEYS_NUM=16;
		CVSDCollection		subKeys(AVG_SUBKEYS_NUM,AVG_SUBKEYS_NUM);
		RegistryClassEnum	rce(&rsk);

		static const UINT32	MAX_KEYNAME_LEN=64;
		TCHAR	szKeyName[MAX_KEYNAME_LEN+2]=_T("");
		DWORD	dwKNLen=(MAX_KEYNAME_LEN+1);

		// first, "collect" all keys since deletion changes enumeration
		for (hr=rce.GetFirstKey(szKeyName, &dwKNLen);
			 (ERROR_SUCCESS == hr);
			 dwKNLen=(MAX_KEYNAME_LEN+1), hr=rce.GetNextKey(szKeyName, &dwKNLen))
		{
			UINT32	ulKNLen=_tcslen(szKeyName);
			if ((hr=subKeys.AddItem(szKeyName, ((ulKNLen+1) * sizeof(TCHAR)))) != ERROR_SUCCESS)
				return hr;
		}

		// now delete recursively
		CVSDCollEnum	ske(subKeys);
		LPVOID			pItem=NULL;
		for (hr=ske.GetFirstItem(pItem); ERROR_SUCCESS == hr; hr=ske.GetNextItem(pItem))
			if ((hr=rsk.DeleteKey((LPCTSTR) pItem, TRUE)) != ERROR_SUCCESS)
				return hr;
	}

	return RegDeleteKey((HKEY) m_hKey, (LPCTSTR) pszKey);
}