Index: base/applications/charmap/charmap.c =================================================================== --- base/applications/charmap/charmap.c (revision 51049) +++ base/applications/charmap/charmap.c (working copy) @@ -8,6 +8,7 @@ */ #include +#include "settings.c" #define ID_ABOUT 0x1 @@ -414,6 +415,7 @@ } UnregisterMapClasses(hInstance); } + LoadSettings(); return Ret; } Index: base/applications/charmap/lang/en-US.rc =================================================================== --- base/applications/charmap/lang/en-US.rc (revision 51049) +++ base/applications/charmap/lang/en-US.rc (working copy) @@ -1,20 +1,29 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -IDD_CHARMAP DIALOGEX 6, 6, 293, 205 //233 +IDD_CHARMAP DIALOGEX 6, 6, 315, 295 //295 is for Windows7-like charmap, 205 for old one CAPTION "Character Map" FONT 8,"MS Shell Dlg",0,0 STYLE DS_SHELLFONT | WS_BORDER | WS_VISIBLE | WS_SYSMENU | WS_MINIMIZEBOX BEGIN LTEXT "Font:", IDC_STATIC, 6, 7, 24, 9 - COMBOBOX IDC_FONTCOMBO, 36, 5, 210, 210, WS_CHILD | WS_VISIBLE | WS_VSCROLL | CBS_DROPDOWNLIST | CBS_SORT | CBS_HASSTRINGS - PUSHBUTTON "Help", IDC_CMHELP, 249, 5, 35, 13 - CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL, 20, 22, 266, 156 + COMBOBOX IDC_FONTCOMBO, 36, 5, 232, 210, WS_CHILD | WS_VISIBLE | WS_VSCROLL | CBS_DROPDOWNLIST | CBS_SORT | CBS_HASSTRINGS + PUSHBUTTON "Help", IDC_CMHELP, 271, 5, 35, 13 + CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL, 20, 22, 288, 156 LTEXT "Characters to copy:", IDC_STATIC, 6, 188, 66, 9 - CONTROL "",IDC_TEXTBOX,RICHEDIT_CLASS,ES_AUTOHSCROLL | WS_BORDER | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 74, 186, 114, 13 - DEFPUSHBUTTON "Select", IDC_SELECT, 194, 186, 44, 13 - PUSHBUTTON "Copy", IDC_COPY, 242, 186, 44, 13, WS_DISABLED - //AUTOCHECKBOX "Advanced view", IDC_ADVVIEW, 10, 204, 64, 9, WS_CHILD | WS_VISIBLE | WS_TABSTOP - //EDITTEXT IDC_DISPLAY, 8, 217, 278, 13, WS_VISIBLE | WS_TABSTOP | ES_READONLY + EDITTEXT IDC_TEXTBOX, 75, 186, 136, 13, WS_CHILD | WS_VISIBLE | WS_TABSTOP + DEFPUSHBUTTON "Select", IDC_SELECT, 216, 186, 44, 13 + PUSHBUTTON "Copy", IDC_COPY, 266, 186, 44, 13, WS_DISABLED + AUTOCHECKBOX "Advanced view", IDC_ADVVIEW, 6, 204, 64, 9, WS_CHILD | WS_VISIBLE | WS_TABSTOP + LTEXT "Character set:", IDC_CHARSET, 6, 224, 66, 9 + COMBOBOX IDC_CHARSETCOMBO, 75, 221, 145, 210, WS_CHILD | WS_VSCROLL | CBS_DROPDOWNLIST | CBS_SORT | CBS_HASSTRINGS | WS_TABSTOP + LTEXT "Go to Unicode:", IDC_GOTOUNICODE, 225, 224, 66, 9 + EDITTEXT IDC_GOTOUNICOTXT, 280, 221, 30, 13, WS_CHILD | WS_TABSTOP + LTEXT "Group by:", IDC_GROUPBY, 6, 244, 66, 9 + COMBOBOX IDC_GROUPBYCOMBO, 75, 241, 145, 105, WS_CHILD | WS_VSCROLL | CBS_DROPDOWNLIST | CBS_SORT | CBS_HASSTRINGS | WS_TABSTOP + LTEXT "Search for:", IDC_SEARCHFOR, 6, 264, 66, 9 + EDITTEXT IDC_SEARCHFORTXT, 75, 261, 145, 13, WS_CHILD | WS_TABSTOP + PUSHBUTTON "Search", IDC_SEARCHBTN, 225, 261, 44, 13, WS_TABSTOP | WS_DISABLED + EDITTEXT IDC_DISPLAY, 6, 280, 305, 13, WS_VISIBLE | WS_TABSTOP | ES_READONLY END IDD_ABOUTBOX DIALOGEX 22,16,210,182 Index: base/applications/charmap/precomp.h =================================================================== --- base/applications/charmap/precomp.h (revision 51049) +++ base/applications/charmap/precomp.h (working copy) @@ -6,12 +6,14 @@ #include #include #include +#include #include "resource.h" #define XCELLS 20 #define YCELLS 10 #define XLARGE 45 #define YLARGE 25 +#define COUNT_OF(a) (sizeof(a)/sizeof(a[0])) #define FM_SETFONT (WM_USER + 1) #define FM_GETCHAR (WM_USER + 2) Index: base/applications/charmap/resource.h =================================================================== --- base/applications/charmap/resource.h (revision 51049) +++ base/applications/charmap/resource.h (working copy) @@ -17,3 +17,13 @@ #define IDS_LICENSE 1010 #define IDS_ABOUT 1011 + +#define IDC_CHARSETCOMBO 1012 +#define IDC_CHARSET 1013 +#define IDC_GROUPBY 1014 +#define IDC_GROUPBYCOMBO 1015 +#define IDC_GOTOUNICODE 1016 +#define IDC_GOTOUNICOTXT 1017 +#define IDC_SEARCHFOR 1018 +#define IDC_SEARCHFORTXT 1019 +#define IDC_SEARCHBTN 1020 Index: base/applications/charmap/settings.c =================================================================== --- base/applications/charmap/settings.c (revision 0) +++ base/applications/charmap/settings.c (revision 0) @@ -0,0 +1,54 @@ +#include + +static LPCTSTR s_szRegistryKey = _T("Software\\Microsoft\\CharMap"); + +LONG QueryStringValue(HKEY hKey, LPCTSTR lpSubKey, LPCTSTR lpValueName, LPTSTR pszBuffer, DWORD dwBufferLen) +{ + LONG lResult; + HKEY hSubKey = NULL; + DWORD cbData, dwType; + + if (lpSubKey) + { + lResult = RegOpenKey(hKey, lpSubKey, &hSubKey); + if (lResult != ERROR_SUCCESS) + goto done; + hKey = hSubKey; + } + + cbData = (dwBufferLen - 1) * sizeof(*pszBuffer); + lResult = RegQueryValueEx(hKey, lpValueName, NULL, &dwType, (LPBYTE) pszBuffer, &cbData); + if (lResult != ERROR_SUCCESS) + goto done; + if (dwType != REG_SZ) + { + lResult = -1; + goto done; + } + + pszBuffer[cbData / sizeof(*pszBuffer)] = _T('\0'); + +done: + if (lResult != ERROR_SUCCESS) + pszBuffer[0] = _T('\0'); + if (hSubKey) + RegCloseKey(hSubKey); + return lResult; +} + +void LoadSettings(void) +{ + HKEY hKey = NULL; + TCHAR szBuffer[MAX_PATH]; + + if (QueryStringValue(HKEY_CURRENT_USER, s_szRegistryKey, _T("Font"), + szBuffer, COUNT_OF(szBuffer)) == ERROR_SUCCESS) + { + //QueryString(hKey, _T("Font"), strFont, sizeof(strFont) / sizeof(strFont[0])); + TCHAR str[255]; + _stprintf(str, _T("Message text goes here: "), szBuffer); + MessageBox(0, str, 0, MB_OK); + } + + RegCloseKey(hKey); +} \ No newline at end of file