本文整理汇总了C++中nregistry::CKey::Create方法的典型用法代码示例。如果您正苦于以下问题:C++ CKey::Create方法的具体用法?C++ CKey::Create怎么用?C++ CKey::Create使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nregistry::CKey
的用法示例。
在下文中一共展示了CKey::Create方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: CreateRegKey
LONG CStartupInfo::CreateRegKey(HKEY parentKey,
const CSysString &keyName, NRegistry::CKey &destKey) const
{
return destKey.Create(parentKey, GetFullKeyName(keyName));
}