-} ClockWndFormats[] = {
- {TRUE, TIME_NOSECONDS, NULL},
- {FALSE, 0, TEXT("dddd")},
- {FALSE, DATE_SHORTDATE, NULL},
-};
+}ClockWndFormats[]= {
+{TRUE, 0, NULL},
+{FALSE, 0, TEXT("dddd")},
+{FALSE, DATE_SHORTDATE, NULL}
+};
+
+HRESULT RegGetDWord(HKEY hKey, LPCTSTR szValueName, DWORD * lpdwResult)
+{
+ LONG lResult;
+ DWORD dwDataSize = sizeof(DWORD);
+ DWORD dwType = 0;
+
+ // Check input parameters...
+ if (hKey == NULL || lpdwResult == NULL) return E_INVALIDARG;
+
+ // Get dword value from the registry...
+ lResult = RegQueryValueEx(hKey, szValueName, 0, &dwType, (LPBYTE) lpdwResult, &dwDataSize );
+
+ // Check result and make sure the registry value is a DWORD(REG_DWORD)...
+ if (lResult != ERROR_SUCCESS) return HRESULT_FROM_WIN32(lResult);
+ else if (dwType != REG_DWORD) return DISP_E_TYPEMISMATCH;
+
+ return NOERROR;
+}
+
+void LoadSettings(void)
+{
+ HKEY hKey = NULL;
+ DWORD dwValue;
+
+ if (RegOpenKey(HKEY_CURRENT_USER, s_szRegistryKey, &hKey) == ERROR_SUCCESS)
+ {
+ RegGetDWord(hKey, TEXT("blShowSeconds"), &dwValue);
+ if (dwValue == 1)
+ {
+ blShowSeconds = TRUE;
+ }
+ else
+ {
+ blShowSeconds = FALSE;
+ }
+
+ RegCloseKey(hKey);
+ }
+}