本文整理汇总了C++中Registry::Read方法的典型用法代码示例。如果您正苦于以下问题:C++ Registry::Read方法的具体用法?C++ Registry::Read怎么用?C++ Registry::Read使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Registry
的用法示例。
在下文中一共展示了Registry::Read方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LoadDataFromRegistry
//*************************************************************************
// Method: LoadDataFromRegistry
// Description: loads the serial number and registration key from the registry
// and decodes the information
//
// Parameters:
// None
//
// Return Value: None
//*************************************************************************
void RegistrationMgr::LoadDataFromRegistry()
{
Registry registry;
regData->SetCustomerType(NormalCustomer);
regData->SetNumberOfDaysValid(15);
regData->SetFunctionalityType(TimeTrial);
regData->SetProductType(Holodeck);
regData->SetKeyVersion(HolodeckBasic);
regData->SetNumberOfLicensesPurchased(0);
regData->SetSerialNumber("");
regData->SetRegistrationKey("");
if (!registry.OpenKey(ROOT_KEY, ROOT_PATH, KEY_QUERY_VALUE))
return;
SiString serialNum, regKey;
if (!registry.Read(SERIAL_NUMBER_VALUE_NAME, serialNum))
return;
if (!registry.Read(REGISTRATION_KEY_VALUE_NAME, regKey))
return;
regData->SetSerialNumber(serialNum);
regData->SetRegistrationKey(regKey);
RegistrationKeyGenerator::GetInstance()->DecodeRegistrationKey(regData);
}
示例2: GetNumberOfDaysRemaining
//*************************************************************************
// Method: GetNumberOfDaysRemaining
// Description: returns the number of days remaining for this license
//
// Parameters:
// None
//
// Return Value: the number of days remaining for this license
//*************************************************************************
int RegistrationMgr::GetNumberOfDaysRemaining()
{
DWORD dwHighValue, dwLowValue;
::FILETIME currentFileTime;
ULARGE_INTEGER trialStartTime, currentTime, calculatedTime;
int numDays;
Registry registry;
if (!registry.OpenKey(ROOT_KEY, ROOT_PATH, KEY_QUERY_VALUE))
return 0;
if (!registry.Read("Config1", dwHighValue))
return 0;
if (!registry.Read("Config2", dwLowValue))
return 0;
trialStartTime.HighPart = dwHighValue;
trialStartTime.LowPart = dwLowValue;
GetSystemTimeAsFileTime(¤tFileTime);
currentTime.HighPart = currentFileTime.dwHighDateTime;
currentTime.LowPart = currentFileTime.dwLowDateTime;
calculatedTime.QuadPart = currentTime.QuadPart - trialStartTime.QuadPart;
numDays = (int)((calculatedTime.QuadPart * .0000001) / 86400); //calculated in 100ns increments
return GetNumberOfDaysValid() - numDays;
}