Click here to Skip to main content
15,914,447 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How to use GetTimeZoneInformation Pin
dan o3-Jan-08 21:36
dan o3-Jan-08 21:36 
GeneralRe: How to use GetTimeZoneInformation Pin
CodingLover3-Jan-08 21:47
CodingLover3-Jan-08 21:47 
GeneralRe: How to use GetTimeZoneInformation Pin
dan o3-Jan-08 22:06
dan o3-Jan-08 22:06 
GeneralRe: How to use GetTimeZoneInformation Pin
CodingLover3-Jan-08 22:10
CodingLover3-Jan-08 22:10 
GeneralRe: How to use GetTimeZoneInformation Pin
CodingLover6-Jan-08 19:49
CodingLover6-Jan-08 19:49 
GeneralRe: How to use GetTimeZoneInformation Pin
dan o6-Jan-08 22:28
dan o6-Jan-08 22:28 
GeneralRe: How to use GetTimeZoneInformation Pin
CodingLover6-Jan-08 22:39
CodingLover6-Jan-08 22:39 
GeneralRe: How to use GetTimeZoneInformation Pin
dan o6-Jan-08 23:10
dan o6-Jan-08 23:10 
i wonder if you did exactly as below

.h

m_pszTimeZones
m_pszTimeZonesNames

.cpp
void <myclassname>::TestTZ()
{
HKEY hKey, Key;
DWORD dwType = REG_SZ;
int iRet = 0;
CString strName, strValue, strPath, strKey;

strPath = _T("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Time Zones");

iRet = RegOpenKeyEx(HKEY_LOCAL_MACHINE, strPath, 0, KEY_READ, &hKey);

if (iRet != ERROR_SUCCESS)
return;

TCHAR achKey[MAX_PATH];
TCHAR achClass[MAX_PATH] = _T("");
DWORD cchClassName = MAX_PATH;
DWORD cSubKeys;
DWORD cbMaxSubKey;
DWORD cchMaxClass;
DWORD cValues;
DWORD cchMaxValue;
DWORD cbMaxValueData;
DWORD cbSecurityDescriptor;
FILETIME ftLastWriteTime;

DWORD i;
DWORD retCode;

TCHAR buffer[MAX_PATH];
DWORD dwSize = sizeof(buffer);

// Get the class name and the value count.
RegQueryInfoKey(hKey, // key handle
achClass, // buffer for class name
&cchClassName, // length of class string
NULL, // reserved
&cSubKeys, // number of subkeys
&cbMaxSubKey, // longest subkey size
&cchMaxClass, // longest class string
&cValues, // number of values for this key
&cchMaxValue, // longest value name
&cbMaxValueData, // longest value data
&cbSecurityDescriptor, // security descriptor
&ftLastWriteTime); // last write time

// Enumerate the child keys, until RegEnumKeyEx fails. Then
// get the name of each child key and copy it into the list box.

for (i = 0, retCode = ERROR_SUCCESS;retCode == ERROR_SUCCESS; i++)
{
ZeroMemory(&achKey, sizeof(achKey));
cbMaxSubKey = sizeof(achKey);
retCode = RegEnumKeyEx(hKey, i, achKey, &cbMaxSubKey, NULL, NULL, NULL, &ftLastWriteTime);
if (retCode == (DWORD)ERROR_SUCCESS)
{
strName.Format( _T("%s"), achKey);

strKey = strPath + "\\" + strName;
iRet = RegOpenKeyEx(HKEY_LOCAL_MACHINE, strKey, 0, KEY_READ, &Key);

if (iRet == ERROR_SUCCESS)
{
ZeroMemory(&buffer, sizeof(buffer));
dwSize = sizeof(buffer); //again
iRet = RegQueryValueEx(Key, _T("Display"), NULL, &dwType, (BYTE *)buffer, &dwSize);

if (iRet == ERROR_SUCCESS)
{
strValue.Format(_T("%s"), buffer);
m_pszTimeZones.Add( strValue );
}

if (iRet == ERROR_SUCCESS)
{
ZeroMemory(&buffer, sizeof(buffer));
dwSize = sizeof(buffer); //again
iRet = RegQueryValueEx(Key, _T("Std"), NULL, &dwType, (BYTE *)buffer, &dwSize);

if (iRet == ERROR_SUCCESS)
{
strValue.Format(_T("%s"), buffer);
m_pszTimeZonesNames.Add( strValue );
}
}

RegCloseKey(Key);
}
}
}
RegCloseKey( hKey );
}</myclassname>
GeneralRe: How to use GetTimeZoneInformation Pin
CodingLover6-Jan-08 23:27
CodingLover6-Jan-08 23:27 
GeneralRe: How to use GetTimeZoneInformation Pin
dan o6-Jan-08 23:43
dan o6-Jan-08 23:43 
GeneralRe: How to use GetTimeZoneInformation Pin
CodingLover6-Jan-08 23:57
CodingLover6-Jan-08 23:57 
QuestionQuite similer application Pin
CodingLover7-Jan-08 18:33
CodingLover7-Jan-08 18:33 
GeneralRe: Quite similer application Pin
dan o8-Jan-08 1:05
dan o8-Jan-08 1:05 
GeneralSome API Pin
john56321-Jan-08 18:46
john56321-Jan-08 18:46 
GeneralRe: Some API Pin
Naveen1-Jan-08 18:52
Naveen1-Jan-08 18:52 
GeneralRe: Some API Pin
Nishad S1-Jan-08 19:01
Nishad S1-Jan-08 19:01 
Generalverifying file path Pin
neha.agarwal271-Jan-08 18:25
neha.agarwal271-Jan-08 18:25 
GeneralRe: verifying file path Pin
Nishad S1-Jan-08 18:48
Nishad S1-Jan-08 18:48 
GeneralRe: verifying file path Pin
Naveen1-Jan-08 18:49
Naveen1-Jan-08 18:49 
GeneralRe: verifying file path Pin
Rahul Vaishnav1-Jan-08 19:24
Rahul Vaishnav1-Jan-08 19:24 
GeneralRe: verifying file path Pin
ThatsAlok1-Jan-08 21:35
ThatsAlok1-Jan-08 21:35 
GeneralRe: verifying file path Pin
Hamid_RT2-Jan-08 2:45
Hamid_RT2-Jan-08 2:45 
GeneralSending or posting message from a new created thread Pin
Md. Ali Naser Khan1-Jan-08 18:23
Md. Ali Naser Khan1-Jan-08 18:23 
GeneralRe: Sending or posting message from a new created thread Pin
Haroon Sarwar1-Jan-08 18:46
Haroon Sarwar1-Jan-08 18:46 
QuestionRe: Sending or posting message from a new created thread Pin
Nishad S1-Jan-08 18:47
Nishad S1-Jan-08 18:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.