本文整理汇总了C++中nregistry::CKey类的典型用法代码示例。如果您正苦于以下问题:C++ CKey类的具体用法?C++ CKey怎么用?C++ CKey使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CKey类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetRegKeyValue
void CStartupInfo::SetRegKeyValue(HKEY parentKey, const CSysString &keyName,
LPCTSTR valueName, bool value) const
{
NRegistry::CKey regKey;
CreateRegKey(parentKey, keyName, regKey);
regKey.SetValue(valueName, value);
}
示例2: CheckContextMenuHandler
bool CheckContextMenuHandler(const UString &path, UInt32 wow)
{
// NSynchronization::CCriticalSectionLock lock(g_CS);
CSysString s = TEXT("CLSID\\");
s += k_Clsid;
s.AddAscii("\\InprocServer32");
{
NRegistry::CKey key;
if (key.Open(HKEY_CLASSES_ROOT, s, KEY_READ | wow) != ERROR_SUCCESS)
return false;
UString regPath;
if (key.QueryValue(NULL, regPath) != ERROR_SUCCESS)
return false;
if (!path.IsEqualTo_NoCase(regPath))
return false;
}
return
CheckHandlerCommon(Get_ContextMenuHandler_KeyName(k_KeyName_File), wow);
/*
&& CheckHandlerCommon(Get_ContextMenuHandler_KeyName(k_KeyName_Directory), wow)
// && CheckHandlerCommon(Get_ContextMenuHandler_KeyName(k_KeyName_Folder))
&& CheckHandlerCommon(Get_DragDropHandler_KeyName(k_KeyName_Directory), wow)
&& CheckHandlerCommon(Get_DragDropHandler_KeyName(k_KeyName_Drive), wow);
*/
}
示例3: ReadPathFromRegistry
static bool ReadPathFromRegistry(HKEY baseKey, CSysString &path)
{
NRegistry::CKey key;
if(key.Open(baseKey, kRegistryPath, KEY_READ) == ERROR_SUCCESS)
if (key.QueryValue(kProgramPathValue, path) == ERROR_SUCCESS)
{
NName::NormalizeDirPathPrefix(path);
return true;
}
return false;
}
示例4: QueryRegKeyValue
bool CStartupInfo::QueryRegKeyValue(HKEY parentKey, const CSysString &keyName,
LPCTSTR valueName, bool valueDefault) const
{
NRegistry::CKey regKey;
if (OpenRegKey(parentKey, keyName, regKey) != ERROR_SUCCESS)
return valueDefault;
bool value;
if(regKey.QueryValue(valueName, value) != ERROR_SUCCESS)
return valueDefault;
return value;
}
示例5: RegisterServer
static BOOL RegisterServer(CLSID clsid, LPCWSTR title)
{
TCHAR clsidString[MAX_PATH];
if (!GetStringFromIID(clsid, clsidString, MAX_PATH))
return FALSE;
UString modulePath;
if (!NDLL::MyGetModuleFileName(g_hInstance, modulePath))
return FALSE;
CRegItem clsidEntries[] =
{
HKEY_CLASSES_ROOT, kClsidMask, NULL, title,
HKEY_CLASSES_ROOT, kClsidInprocMask, NULL, modulePath,
HKEY_CLASSES_ROOT, kClsidInprocMask, L"ThreadingModel", L"Apartment",
NULL, NULL, NULL, NULL
};
//register the CLSID entries
for(int i = 0; clsidEntries[i].hRootKey; i++)
{
TCHAR subKey[MAX_PATH];
wsprintf(subKey, clsidEntries[i].SubKey, clsidString);
NRegistry::CKey key;
if (key.Create(clsidEntries[i].hRootKey, subKey, NULL,
REG_OPTION_NON_VOLATILE, KEY_WRITE) != NOERROR)
return FALSE;
key.SetValue(clsidEntries[i].ValueName, clsidEntries[i].Data);
}
if(IsItWindowsNT())
{
NRegistry::CKey key;
if (key.Create(HKEY_LOCAL_MACHINE, kApprovedKeyPath, NULL,
REG_OPTION_NON_VOLATILE, KEY_WRITE) == NOERROR)
key.SetValue(GetUnicodeString(clsidString), title);
}
return TRUE;
}
示例6: OpenRegKey
LONG CStartupInfo::OpenRegKey(HKEY parentKey,
const CSysString &keyName, NRegistry::CKey &destKey) const
{
return destKey.Open(parentKey, GetFullKeyName(keyName));
}