本文整理汇总了C++中CKey::Close方法的典型用法代码示例。如果您正苦于以下问题:C++ CKey::Close方法的具体用法?C++ CKey::Close怎么用?C++ CKey::Close使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CKey
的用法示例。
在下文中一共展示了CKey::Close方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RecurseDeleteKey
LONG CKey::RecurseDeleteKey(LPCTSTR subKeyName) throw()
{
CKey key;
LONG res = key.Open(_object, subKeyName, KEY_READ | KEY_WRITE);
if (res != ERROR_SUCCESS)
return res;
FILETIME fileTime;
const UInt32 kBufferSize = MAX_PATH + 1; // 256 in ATL
DWORD size = kBufferSize;
TCHAR buffer[kBufferSize];
while (RegEnumKeyEx(key._object, 0, buffer, &size, NULL, NULL, NULL, &fileTime) == ERROR_SUCCESS)
{
res = key.RecurseDeleteKey(buffer);
if (res != ERROR_SUCCESS)
return res;
size = kBufferSize;
}
key.Close();
return DeleteSubKey(subKeyName);
}
示例2: RegisterExt
static void RegisterExt(LPCTSTR lpszExt, LPCTSTR lpszProgID, UINT nIDTypeName,
LPCTSTR* rglpszSymbols, LPCTSTR* rglpszExtRegister,
LPCTSTR* rglpszRegister, int nIcon)
{
// don't overwrite anything with the extensions
CString strWhole;
VERIFY(strWhole.LoadString(nIDTypeName));
CString str;
AfxExtractSubString(str, strWhole, DOCTYPE_PROGID);
rglpszSymbols[1] = lpszProgID;
rglpszSymbols[4] = str;
rglpszSymbols[6] = lpszExt;
TCHAR buf[10];
wsprintf(buf, _T("%d"), nIcon);
rglpszSymbols[7] = buf;
// check for .ext and progid
CKey key;
if (!key.Open(HKEY_CLASSES_ROOT, lpszExt)) // .ext doesn't exist
RegisterHelper(rglpszExtRegister, rglpszSymbols, TRUE);
key.Close();
if (!key.Open(HKEY_CLASSES_ROOT, lpszProgID)) // ProgID doesn't exist (i.e. txtfile)
RegisterHelper(rglpszRegister, rglpszSymbols, TRUE);
}