Hi all,
This question partially related to one of my old question.
Reading the time zone information. Now I'm try to do it in this way. User enter the time offset. Using that value search the registry and find the time zone name. Where I'm stuck is how to search the registry. Here what I'm try up to now.
HKEY hKey;// Handle to the registry
DWORD dwType = REG_SZ;// Data type
char buf[255];// Data
DWORD dwBufSize = sizeof(buf);
// Sub handle to the registry
const char* subKey = "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Time Zones\\Afghanistan Standard Time";
// Open the handler
if(RegOpenKey(HKEY_LOCAL_MACHINE, subKey, &hKey) == ERROR_SUCCESS)
{
// Do the processing, find the name
if(RegQueryValueEx(hKey, "Std", 0, &dwType, (BYTE*)buf, &dwBufSize) == ERROR_SUCCESS)
{
AfxMessageBox(buf);
}
else
{
AfxMessageBox("Error in reading values.", MB_OK);
}
// Close the handler
RegCloseKey(hKey);
}
else
{
AfxMessageBox("Error in reading registry.", MB_OK);
}
This code is work for Afghanistan Standard Time. How can I iteratively change until found the correct offset.