mirror of
https://github.com/reactos/reactos.git
synced 2025-04-20 04:20:46 +00:00
[INTL]
- Unicodify the CPL. Get rid of <tchar.h>. - Pass a pointer to all getter and setter functions of the customization property sheet pages. - Remove the "Property of" text from the property sheets. - Convert "SendMessage(GetDlgItem(..." to "SendDlgItemMessage(...". svn path=/trunk/; revision=69308
This commit is contained in:
parent
40d3c19242
commit
0634e43fab
12 changed files with 1161 additions and 1162 deletions
|
@ -25,12 +25,12 @@ GetSupportedCP(VOID)
|
|||
CPINFOEX cpInfEx;
|
||||
//TCHAR Section[MAX_PATH];
|
||||
|
||||
Count = SetupGetLineCount(hIntlInf, _T("CodePages"));
|
||||
Count = SetupGetLineCountW(hIntlInf, L"CodePages");
|
||||
if (Count <= 0) return FALSE;
|
||||
|
||||
for (Number = 0; Number < (UINT)Count; Number++)
|
||||
{
|
||||
if (SetupGetLineByIndex(hIntlInf, _T("CodePages"), Number, &infCont) &&
|
||||
if (SetupGetLineByIndexW(hIntlInf, L"CodePages", Number, &infCont) &&
|
||||
SetupGetIntField(&infCont, 0, (PINT)&uiCPage))
|
||||
{
|
||||
if (!(hCPage = GlobalAlloc(GHND, sizeof(CPAGE)))) return FALSE;
|
||||
|
@ -43,9 +43,9 @@ GetSupportedCP(VOID)
|
|||
|
||||
if (GetCPInfoEx(uiCPage, 0, &cpInfEx))
|
||||
{
|
||||
_tcscpy(lpCPage->Name, cpInfEx.CodePageName);
|
||||
wcscpy(lpCPage->Name, cpInfEx.CodePageName);
|
||||
}
|
||||
else if (!SetupGetStringField(&infCont, 1, lpCPage->Name, MAX_PATH, NULL))
|
||||
else if (!SetupGetStringFieldW(&infCont, 1, lpCPage->Name, MAX_PATH, NULL))
|
||||
{
|
||||
GlobalUnlock(hCPage);
|
||||
GlobalFree(hCPage);
|
||||
|
@ -61,13 +61,13 @@ GetSupportedCP(VOID)
|
|||
}
|
||||
|
||||
static BOOL CALLBACK
|
||||
InstalledCPProc(LPTSTR lpStr)
|
||||
InstalledCPProc(PWSTR lpStr)
|
||||
{
|
||||
LPCPAGE lpCP;
|
||||
UINT uiCP;
|
||||
|
||||
lpCP = PCPage;
|
||||
uiCP = _ttol(lpStr);
|
||||
uiCP = _wtol(lpStr);
|
||||
|
||||
for (;;)
|
||||
{
|
||||
|
@ -95,7 +95,7 @@ InitCodePagesList(HWND hwndDlg)
|
|||
|
||||
hList = GetDlgItem(hwndDlg, IDC_CONV_TABLES);
|
||||
|
||||
hIntlInf = SetupOpenInfFile(_T("intl.inf"), NULL, INF_STYLE_WIN4, NULL);
|
||||
hIntlInf = SetupOpenInfFileW(L"intl.inf", NULL, INF_STYLE_WIN4, NULL);
|
||||
|
||||
if (hIntlInf == INVALID_HANDLE_VALUE)
|
||||
return;
|
||||
|
@ -159,21 +159,21 @@ InitCodePagesList(HWND hwndDlg)
|
|||
}
|
||||
|
||||
static BOOL CALLBACK
|
||||
LocalesEnumProc(LPTSTR lpLocale)
|
||||
LocalesEnumProc(PWSTR lpLocale)
|
||||
{
|
||||
LCID lcid;
|
||||
TCHAR lang[255];
|
||||
WCHAR lang[255];
|
||||
INT index;
|
||||
BOOL bNoShow = FALSE;
|
||||
|
||||
lcid = _tcstoul(lpLocale, NULL, 16);
|
||||
lcid = wcstoul(lpLocale, NULL, 16);
|
||||
|
||||
if (lcid == MAKELCID(MAKELANGID(LANG_SPANISH, SUBLANG_SPANISH), SORT_DEFAULT) ||
|
||||
lcid == MAKELCID(MAKELANGID(LANG_SPANISH, SUBLANG_SPANISH_MODERN), SORT_DEFAULT))
|
||||
{
|
||||
if (bSpain == FALSE)
|
||||
{
|
||||
LoadString(hApplet, IDS_SPAIN, lang, 255);
|
||||
LoadStringW(hApplet, IDS_SPAIN, lang, 255);
|
||||
bSpain = TRUE;
|
||||
}
|
||||
else
|
||||
|
@ -183,20 +183,20 @@ LocalesEnumProc(LPTSTR lpLocale)
|
|||
}
|
||||
else
|
||||
{
|
||||
GetLocaleInfo(lcid, LOCALE_SLANGUAGE, lang, sizeof(lang)/sizeof(TCHAR));
|
||||
GetLocaleInfoW(lcid, LOCALE_SLANGUAGE, lang, sizeof(lang)/sizeof(WCHAR));
|
||||
}
|
||||
|
||||
if (bNoShow == FALSE)
|
||||
{
|
||||
index = SendMessage(hLangList,
|
||||
CB_ADDSTRING,
|
||||
0,
|
||||
(LPARAM)lang);
|
||||
index = SendMessageW(hLangList,
|
||||
CB_ADDSTRING,
|
||||
0,
|
||||
(LPARAM)lang);
|
||||
|
||||
SendMessage(hLangList,
|
||||
CB_SETITEMDATA,
|
||||
index,
|
||||
(LPARAM)lcid);
|
||||
SendMessageW(hLangList,
|
||||
CB_SETITEMDATA,
|
||||
index,
|
||||
(LPARAM)lcid);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
@ -205,17 +205,17 @@ LocalesEnumProc(LPTSTR lpLocale)
|
|||
static VOID
|
||||
InitLanguagesList(HWND hwndDlg)
|
||||
{
|
||||
TCHAR langSel[255];
|
||||
WCHAR langSel[255];
|
||||
|
||||
hLangList = GetDlgItem(hwndDlg, IDC_LANGUAGE_COMBO);
|
||||
|
||||
bSpain = FALSE;
|
||||
EnumSystemLocales(LocalesEnumProc, LCID_SUPPORTED);
|
||||
EnumSystemLocalesW(LocalesEnumProc, LCID_SUPPORTED);
|
||||
|
||||
/* Select current locale */
|
||||
GetLocaleInfo(GetSystemDefaultLCID(), LOCALE_SLANGUAGE, langSel, sizeof(langSel)/sizeof(TCHAR));
|
||||
GetLocaleInfoW(GetSystemDefaultLCID(), LOCALE_SLANGUAGE, langSel, sizeof(langSel)/sizeof(WCHAR));
|
||||
|
||||
SendMessage(hLangList, CB_SELECTSTRING, -1, (LPARAM)langSel);
|
||||
SendMessageW(hLangList, CB_SELECTSTRING, -1, (LPARAM)langSel);
|
||||
}
|
||||
|
||||
static VOID
|
||||
|
@ -224,26 +224,26 @@ GetCurrentDPI(LPTSTR szDPI)
|
|||
DWORD dwType, dwSize, dwDPI, dwDefDPI = 0x00000060; // Default 96 DPI
|
||||
HKEY hKey;
|
||||
|
||||
if (RegCreateKeyEx(HKEY_LOCAL_MACHINE, _T("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\FontDPI"), 0, NULL,
|
||||
REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey, NULL) != ERROR_SUCCESS)
|
||||
if (RegCreateKeyExW(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\FontDPI", 0, NULL,
|
||||
REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey, NULL) != ERROR_SUCCESS)
|
||||
{
|
||||
_tcscpy(szDPI, _T("96"));
|
||||
wcscpy(szDPI, L"96");
|
||||
return;
|
||||
}
|
||||
|
||||
dwType = REG_DWORD;
|
||||
dwSize = sizeof(DWORD);
|
||||
|
||||
if (RegQueryValueEx(hKey, _T("LogPixels"), NULL, &dwType, (LPBYTE)&dwDPI, &dwSize) != ERROR_SUCCESS)
|
||||
if (RegQueryValueExW(hKey, L"LogPixels", NULL, &dwType, (LPBYTE)&dwDPI, &dwSize) != ERROR_SUCCESS)
|
||||
{
|
||||
if (RegSetValueEx(hKey, _T("LogPixels"), 0, REG_DWORD, (LPBYTE)&dwDefDPI, sizeof(DWORD)) == ERROR_SUCCESS)
|
||||
if (RegSetValueExW(hKey, L"LogPixels", 0, REG_DWORD, (LPBYTE)&dwDefDPI, sizeof(DWORD)) == ERROR_SUCCESS)
|
||||
{
|
||||
_tcscpy(szDPI, _T("96"));
|
||||
wcscpy(szDPI, L"96");
|
||||
RegCloseKey(hKey);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else wsprintf(szDPI, _T("%d"), dwDPI);
|
||||
else wsprintf(szDPI, L"%d", dwDPI);
|
||||
|
||||
RegCloseKey(hKey);
|
||||
}
|
||||
|
@ -251,16 +251,16 @@ GetCurrentDPI(LPTSTR szDPI)
|
|||
VOID
|
||||
SetNonUnicodeLang(HWND hwnd, LCID lcid)
|
||||
{
|
||||
TCHAR szDefCP[5 + 1], szSection[MAX_PATH], szDPI[3 + 1];
|
||||
WCHAR szDefCP[5 + 1], szSection[MAX_PATH], szDPI[3 + 1];
|
||||
HINF hFontInf;
|
||||
UINT Count;
|
||||
|
||||
GetLocaleInfo(MAKELCID(lcid, SORT_DEFAULT), LOCALE_IDEFAULTCODEPAGE, szDefCP, sizeof(szDefCP) / sizeof(TCHAR));
|
||||
GetLocaleInfoW(MAKELCID(lcid, SORT_DEFAULT), LOCALE_IDEFAULTCODEPAGE, szDefCP, sizeof(szDefCP) / sizeof(WCHAR));
|
||||
GetCurrentDPI(szDPI);
|
||||
|
||||
wsprintf(szSection, _T("Font.CP%s.%s"), szDefCP, szDPI);
|
||||
wsprintf(szSection, L"Font.CP%s.%s", szDefCP, szDPI);
|
||||
|
||||
hFontInf = SetupOpenInfFile(_T("font.inf"), NULL, INF_STYLE_WIN4, NULL);
|
||||
hFontInf = SetupOpenInfFileW(L"font.inf", NULL, INF_STYLE_WIN4, NULL);
|
||||
|
||||
if (hFontInf == INVALID_HANDLE_VALUE)
|
||||
return;
|
||||
|
@ -274,9 +274,9 @@ SetNonUnicodeLang(HWND hwnd, LCID lcid)
|
|||
Count = (UINT) SetupGetLineCount(hFontInf, szSection);
|
||||
if (Count <= 0) return;
|
||||
|
||||
if (!SetupInstallFromInfSection(hwnd, hFontInf, szSection, SPINST_REGISTRY & ~SPINST_FILES,
|
||||
NULL, NULL, 0, NULL, NULL, NULL, NULL))
|
||||
MessageBox(hwnd, _T("Unable to install a new language for programs don't support unicode!"),
|
||||
if (!SetupInstallFromInfSectionW(hwnd, hFontInf, szSection, SPINST_REGISTRY & ~SPINST_FILES,
|
||||
NULL, NULL, 0, NULL, NULL, NULL, NULL))
|
||||
MessageBoxW(hwnd, L"Unable to install a new language for programs don't support unicode!",
|
||||
NULL, MB_ICONERROR | MB_OK);
|
||||
|
||||
SetupCloseInfFile(hFontInf);
|
||||
|
@ -288,21 +288,21 @@ VOID
|
|||
SaveSystemSettings(
|
||||
LCID lcid)
|
||||
{
|
||||
TCHAR ACPPage[9];
|
||||
TCHAR OEMPage[9];
|
||||
WCHAR ACPPage[9];
|
||||
WCHAR OEMPage[9];
|
||||
HKEY langKey;
|
||||
DWORD ret;
|
||||
WCHAR value[5];
|
||||
DWORD valuesize;
|
||||
|
||||
ret = GetLocaleInfo(MAKELCID(lcid, SORT_DEFAULT), LOCALE_IDEFAULTCODEPAGE, OEMPage, sizeof(OEMPage)/sizeof(TCHAR));
|
||||
ret = GetLocaleInfoW(MAKELCID(lcid, SORT_DEFAULT), LOCALE_IDEFAULTCODEPAGE, OEMPage, sizeof(OEMPage)/sizeof(WCHAR));
|
||||
if (ret == 0)
|
||||
{
|
||||
PrintErrorMsgBox(IDS_ERROR_OEM_CODE_PAGE);
|
||||
return;
|
||||
}
|
||||
|
||||
ret = GetLocaleInfo(MAKELCID(lcid, SORT_DEFAULT), LOCALE_IDEFAULTANSICODEPAGE, ACPPage, sizeof(ACPPage)/sizeof(TCHAR));
|
||||
ret = GetLocaleInfoW(MAKELCID(lcid, SORT_DEFAULT), LOCALE_IDEFAULTANSICODEPAGE, ACPPage, sizeof(ACPPage)/sizeof(WCHAR));
|
||||
if (ret == 0)
|
||||
{
|
||||
PrintErrorMsgBox(IDS_ERROR_ANSI_CODE_PAGE);
|
||||
|
@ -310,31 +310,31 @@ SaveSystemSettings(
|
|||
}
|
||||
|
||||
/* Set codepages */
|
||||
ret = RegOpenKey(HKEY_LOCAL_MACHINE, _T("SYSTEM\\CurrentControlSet\\Control\\NLS\\CodePage"), &langKey);
|
||||
ret = RegOpenKeyW(HKEY_LOCAL_MACHINE, L"SYSTEM\\CurrentControlSet\\Control\\NLS\\CodePage", &langKey);
|
||||
if (ret != ERROR_SUCCESS)
|
||||
{
|
||||
PrintErrorMsgBox(IDS_ERROR_NLS_CODE_REG);
|
||||
return;
|
||||
}
|
||||
|
||||
RegSetValueEx(langKey, _T("OEMCP"), 0, REG_SZ, (BYTE *)OEMPage, (_tcslen(OEMPage) +1 ) * sizeof(TCHAR));
|
||||
RegSetValueEx(langKey, _T("ACP"), 0, REG_SZ, (BYTE *)ACPPage, (_tcslen(ACPPage) +1 ) * sizeof(TCHAR));
|
||||
RegSetValueExW(langKey, L"OEMCP", 0, REG_SZ, (BYTE *)OEMPage, (wcslen(OEMPage) +1 ) * sizeof(WCHAR));
|
||||
RegSetValueExW(langKey, L"ACP", 0, REG_SZ, (BYTE *)ACPPage, (wcslen(ACPPage) +1 ) * sizeof(WCHAR));
|
||||
|
||||
RegCloseKey(langKey);
|
||||
|
||||
|
||||
wsprintf(value, _T("%04hX"), LANGIDFROMLCID(lcid));
|
||||
valuesize = (_tcslen(value) + 1) * sizeof(TCHAR);
|
||||
wsprintf(value, L"%04hX", LANGIDFROMLCID(lcid));
|
||||
valuesize = (wcslen(value) + 1) * sizeof(WCHAR);
|
||||
|
||||
/* Set language */
|
||||
ret = RegOpenKey(HKEY_LOCAL_MACHINE, _T("SYSTEM\\CurrentControlSet\\Control\\NLS\\Language"), &langKey);
|
||||
ret = RegOpenKeyW(HKEY_LOCAL_MACHINE, L"SYSTEM\\CurrentControlSet\\Control\\NLS\\Language", &langKey);
|
||||
if (ret != ERROR_SUCCESS)
|
||||
{
|
||||
PrintErrorMsgBox(IDS_ERROR_NLS_KEY_REG);
|
||||
return;
|
||||
}
|
||||
|
||||
RegSetValueEx(langKey, _T("Default"), 0, REG_SZ, (BYTE *)value, valuesize);
|
||||
RegSetValueExW(langKey, L"Default", 0, REG_SZ, (BYTE *)value, valuesize);
|
||||
RegCloseKey(langKey);
|
||||
}
|
||||
|
||||
|
|
|
@ -25,89 +25,89 @@
|
|||
|
||||
#include "intl.h"
|
||||
|
||||
#define POSITIVE_EXAMPLE _T("123456789.00")
|
||||
#define NEGATIVE_EXAMPLE _T("-123456789.00")
|
||||
#define POSITIVE_EXAMPLE L"123456789.00"
|
||||
#define NEGATIVE_EXAMPLE L"-123456789.00"
|
||||
#define MAX_FIELD_DIG_SAMPLES 3
|
||||
|
||||
|
||||
static VOID
|
||||
UpdateExamples(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
||||
{
|
||||
TCHAR szBuffer[MAX_FMT_SIZE];
|
||||
WCHAR szBuffer[MAX_FMT_SIZE];
|
||||
|
||||
/* Positive example */
|
||||
GetCurrencyFormat(pGlobalData->lcid, 0,
|
||||
POSITIVE_EXAMPLE,
|
||||
NULL, szBuffer, MAX_FMT_SIZE);
|
||||
GetCurrencyFormatW(pGlobalData->lcid, 0,
|
||||
POSITIVE_EXAMPLE,
|
||||
NULL, szBuffer, MAX_FMT_SIZE);
|
||||
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYPOSSAMPLE), WM_SETTEXT, 0, (LPARAM)szBuffer);
|
||||
SendDlgItemMessageW(hwndDlg, IDC_CURRENCYPOSSAMPLE, WM_SETTEXT, 0, (LPARAM)szBuffer);
|
||||
|
||||
/* Negative example */
|
||||
GetCurrencyFormat(pGlobalData->lcid, 0,
|
||||
NEGATIVE_EXAMPLE,
|
||||
NULL, szBuffer, MAX_FMT_SIZE);
|
||||
GetCurrencyFormatW(pGlobalData->lcid, 0,
|
||||
NEGATIVE_EXAMPLE,
|
||||
NULL, szBuffer, MAX_FMT_SIZE);
|
||||
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYNEGSAMPLE), WM_SETTEXT, 0, (LPARAM)szBuffer);
|
||||
SendDlgItemMessageW(hwndDlg, IDC_CURRENCYNEGSAMPLE, WM_SETTEXT, 0, (LPARAM)szBuffer);
|
||||
}
|
||||
|
||||
|
||||
static VOID
|
||||
InitCurrencySymbols(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
||||
{
|
||||
TCHAR szBuffer[MAX_FMT_SIZE];
|
||||
WCHAR szBuffer[MAX_FMT_SIZE];
|
||||
|
||||
/* Limit text length */
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYSYMBOL),
|
||||
CB_LIMITTEXT,
|
||||
MAX_CURRENCYSYMBOL,
|
||||
0);
|
||||
SendDlgItemMessageW(hwndDlg, IDC_CURRENCYSYMBOL,
|
||||
CB_LIMITTEXT,
|
||||
MAX_CURRENCYSYMBOL,
|
||||
0);
|
||||
|
||||
/* Set currency symbols */
|
||||
GetLocaleInfo(pGlobalData->lcid,
|
||||
LOCALE_SCURRENCY,
|
||||
szBuffer, MAX_FMT_SIZE);
|
||||
GetLocaleInfoW(pGlobalData->lcid,
|
||||
LOCALE_SCURRENCY,
|
||||
szBuffer, MAX_FMT_SIZE);
|
||||
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYSYMBOL),
|
||||
CB_ADDSTRING,
|
||||
0,
|
||||
(LPARAM)szBuffer);
|
||||
SendDlgItemMessageW(hwndDlg, IDC_CURRENCYSYMBOL,
|
||||
CB_ADDSTRING,
|
||||
0,
|
||||
(LPARAM)szBuffer);
|
||||
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYSYMBOL),
|
||||
CB_SETCURSEL,
|
||||
0, /* Index */
|
||||
0);
|
||||
SendDlgItemMessageW(hwndDlg, IDC_CURRENCYSYMBOL,
|
||||
CB_SETCURSEL,
|
||||
0, /* Index */
|
||||
0);
|
||||
}
|
||||
|
||||
|
||||
static VOID
|
||||
InitCurrencyPositiveFormats(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
||||
{
|
||||
TCHAR szDecimalSep[MAX_FMT_SIZE];
|
||||
TCHAR szThousandSep[MAX_FMT_SIZE];
|
||||
TCHAR szCurrencySymbol[MAX_FMT_SIZE];
|
||||
TCHAR szBuffer[MAX_FMT_SIZE];
|
||||
CURRENCYFMT cyFmt;
|
||||
WCHAR szDecimalSep[MAX_FMT_SIZE];
|
||||
WCHAR szThousandSep[MAX_FMT_SIZE];
|
||||
WCHAR szCurrencySymbol[MAX_FMT_SIZE];
|
||||
WCHAR szBuffer[MAX_FMT_SIZE];
|
||||
CURRENCYFMTW cyFmt;
|
||||
INT nPositiveOrder = 0;
|
||||
INT ret;
|
||||
INT i;
|
||||
|
||||
|
||||
/* Get positive format */
|
||||
ret = GetLocaleInfo(pGlobalData->lcid,
|
||||
LOCALE_ICURRENCY,
|
||||
szBuffer, MAX_FMT_SIZE);
|
||||
ret = GetLocaleInfoW(pGlobalData->lcid,
|
||||
LOCALE_ICURRENCY,
|
||||
szBuffer, MAX_FMT_SIZE);
|
||||
if (ret != 0)
|
||||
{
|
||||
nPositiveOrder = _ttoi(szBuffer);
|
||||
nPositiveOrder = _wtoi(szBuffer);
|
||||
}
|
||||
|
||||
/* Get number of fractional digits */
|
||||
ret = GetLocaleInfo(pGlobalData->lcid,
|
||||
LOCALE_ICURRDIGITS,
|
||||
szBuffer, MAX_FMT_SIZE);
|
||||
ret = GetLocaleInfoW(pGlobalData->lcid,
|
||||
LOCALE_ICURRDIGITS,
|
||||
szBuffer, MAX_FMT_SIZE);
|
||||
if (ret != 0)
|
||||
{
|
||||
cyFmt.NumDigits = _ttoi(szBuffer);
|
||||
cyFmt.NumDigits = _wtoi(szBuffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -115,19 +115,19 @@ InitCurrencyPositiveFormats(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
|||
}
|
||||
|
||||
/* Get decimal separator */
|
||||
ret = GetLocaleInfo(pGlobalData->lcid,
|
||||
LOCALE_SMONDECIMALSEP,
|
||||
szDecimalSep, MAX_FMT_SIZE);
|
||||
ret = GetLocaleInfoW(pGlobalData->lcid,
|
||||
LOCALE_SMONDECIMALSEP,
|
||||
szDecimalSep, MAX_FMT_SIZE);
|
||||
|
||||
/* Get group separator */
|
||||
ret = GetLocaleInfo(pGlobalData->lcid,
|
||||
LOCALE_SMONTHOUSANDSEP,
|
||||
szThousandSep, MAX_FMT_SIZE);
|
||||
ret = GetLocaleInfoW(pGlobalData->lcid,
|
||||
LOCALE_SMONTHOUSANDSEP,
|
||||
szThousandSep, MAX_FMT_SIZE);
|
||||
|
||||
/* Get currency symbol */
|
||||
ret = GetLocaleInfo(pGlobalData->lcid,
|
||||
LOCALE_SCURRENCY,
|
||||
szCurrencySymbol, MAX_FMT_SIZE);
|
||||
ret = GetLocaleInfoW(pGlobalData->lcid,
|
||||
LOCALE_SCURRENCY,
|
||||
szCurrencySymbol, MAX_FMT_SIZE);
|
||||
|
||||
/* positive currency values */
|
||||
cyFmt.LeadingZero = 0;
|
||||
|
@ -140,51 +140,51 @@ InitCurrencyPositiveFormats(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
|||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
cyFmt.PositiveOrder = i;
|
||||
GetCurrencyFormat(pGlobalData->lcid, 0,
|
||||
_T("1.1"),
|
||||
&cyFmt, szBuffer, MAX_FMT_SIZE);
|
||||
GetCurrencyFormatW(pGlobalData->lcid, 0,
|
||||
L"1.1",
|
||||
&cyFmt, szBuffer, MAX_FMT_SIZE);
|
||||
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYPOSVALUE),
|
||||
CB_INSERTSTRING,
|
||||
-1,
|
||||
(LPARAM)szBuffer);
|
||||
SendDlgItemMessageW(hwndDlg, IDC_CURRENCYPOSVALUE,
|
||||
CB_INSERTSTRING,
|
||||
-1,
|
||||
(LPARAM)szBuffer);
|
||||
}
|
||||
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYPOSVALUE),
|
||||
CB_SETCURSEL,
|
||||
nPositiveOrder,
|
||||
0);
|
||||
SendDlgItemMessageW(hwndDlg, IDC_CURRENCYPOSVALUE,
|
||||
CB_SETCURSEL,
|
||||
nPositiveOrder,
|
||||
0);
|
||||
}
|
||||
|
||||
|
||||
static VOID
|
||||
InitCurrencyNegativeFormats(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
||||
{
|
||||
TCHAR szDecimalSep[MAX_FMT_SIZE];
|
||||
TCHAR szThousandSep[MAX_FMT_SIZE];
|
||||
TCHAR szCurrencySymbol[MAX_FMT_SIZE];
|
||||
TCHAR szBuffer[MAX_FMT_SIZE];
|
||||
CURRENCYFMT cyFmt;
|
||||
WCHAR szDecimalSep[MAX_FMT_SIZE];
|
||||
WCHAR szThousandSep[MAX_FMT_SIZE];
|
||||
WCHAR szCurrencySymbol[MAX_FMT_SIZE];
|
||||
WCHAR szBuffer[MAX_FMT_SIZE];
|
||||
CURRENCYFMTW cyFmt;
|
||||
INT nNegativeOrder = 0;
|
||||
INT ret;
|
||||
int i;
|
||||
|
||||
/* Get negative format */
|
||||
ret = GetLocaleInfo(pGlobalData->lcid,
|
||||
LOCALE_INEGCURR,
|
||||
szBuffer, MAX_FMT_SIZE);
|
||||
ret = GetLocaleInfoW(pGlobalData->lcid,
|
||||
LOCALE_INEGCURR,
|
||||
szBuffer, MAX_FMT_SIZE);
|
||||
if (ret != 0)
|
||||
{
|
||||
nNegativeOrder = _ttoi(szBuffer);
|
||||
nNegativeOrder = _wtoi(szBuffer);
|
||||
}
|
||||
|
||||
/* Get number of fractional digits */
|
||||
ret = GetLocaleInfo(pGlobalData->lcid,
|
||||
LOCALE_ICURRDIGITS,
|
||||
szBuffer, MAX_FMT_SIZE);
|
||||
ret = GetLocaleInfoW(pGlobalData->lcid,
|
||||
LOCALE_ICURRDIGITS,
|
||||
szBuffer, MAX_FMT_SIZE);
|
||||
if (ret != 0)
|
||||
{
|
||||
cyFmt.NumDigits = _ttoi(szBuffer);
|
||||
cyFmt.NumDigits = _wtoi(szBuffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -192,19 +192,19 @@ InitCurrencyNegativeFormats(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
|||
}
|
||||
|
||||
/* Get decimal separator */
|
||||
ret = GetLocaleInfo(pGlobalData->lcid,
|
||||
LOCALE_SMONDECIMALSEP,
|
||||
szDecimalSep, MAX_FMT_SIZE);
|
||||
ret = GetLocaleInfoW(pGlobalData->lcid,
|
||||
LOCALE_SMONDECIMALSEP,
|
||||
szDecimalSep, MAX_FMT_SIZE);
|
||||
|
||||
/* Get group separator */
|
||||
ret = GetLocaleInfo(pGlobalData->lcid,
|
||||
LOCALE_SMONTHOUSANDSEP,
|
||||
szThousandSep, MAX_FMT_SIZE);
|
||||
ret = GetLocaleInfoW(pGlobalData->lcid,
|
||||
LOCALE_SMONTHOUSANDSEP,
|
||||
szThousandSep, MAX_FMT_SIZE);
|
||||
|
||||
/* Get currency symbol */
|
||||
ret = GetLocaleInfo(pGlobalData->lcid,
|
||||
LOCALE_SCURRENCY,
|
||||
szCurrencySymbol, MAX_FMT_SIZE);
|
||||
ret = GetLocaleInfoW(pGlobalData->lcid,
|
||||
LOCALE_SCURRENCY,
|
||||
szCurrencySymbol, MAX_FMT_SIZE);
|
||||
|
||||
/* negative currency values */
|
||||
cyFmt.LeadingZero = 0;
|
||||
|
@ -217,49 +217,49 @@ InitCurrencyNegativeFormats(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
|||
for (i = 0; i < 16; i++)
|
||||
{
|
||||
cyFmt.NegativeOrder = i;
|
||||
GetCurrencyFormat(pGlobalData->lcid, 0,
|
||||
_T("-1.1"),
|
||||
&cyFmt, szBuffer, MAX_FMT_SIZE);
|
||||
GetCurrencyFormatW(pGlobalData->lcid, 0,
|
||||
L"-1.1",
|
||||
&cyFmt, szBuffer, MAX_FMT_SIZE);
|
||||
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYNEGVALUE),
|
||||
CB_INSERTSTRING,
|
||||
-1,
|
||||
(LPARAM)szBuffer);
|
||||
SendDlgItemMessageW(hwndDlg, IDC_CURRENCYNEGVALUE,
|
||||
CB_INSERTSTRING,
|
||||
-1,
|
||||
(LPARAM)szBuffer);
|
||||
}
|
||||
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYNEGVALUE),
|
||||
CB_SETCURSEL,
|
||||
nNegativeOrder,
|
||||
0);
|
||||
SendDlgItemMessageW(hwndDlg, IDC_CURRENCYNEGVALUE,
|
||||
CB_SETCURSEL,
|
||||
nNegativeOrder,
|
||||
0);
|
||||
}
|
||||
|
||||
|
||||
static VOID
|
||||
InitCurrencyDecimalSeparators(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
||||
{
|
||||
TCHAR szBuffer[MAX_FMT_SIZE];
|
||||
WCHAR szBuffer[MAX_FMT_SIZE];
|
||||
|
||||
/* Limit text length */
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYDECSEP),
|
||||
CB_LIMITTEXT,
|
||||
MAX_CURRENCYDECSEP,
|
||||
0);
|
||||
SendDlgItemMessageW(hwndDlg, IDC_CURRENCYDECSEP,
|
||||
CB_LIMITTEXT,
|
||||
MAX_CURRENCYDECSEP,
|
||||
0);
|
||||
|
||||
/* Get decimal separator */
|
||||
GetLocaleInfo(pGlobalData->lcid,
|
||||
LOCALE_SMONDECIMALSEP,
|
||||
szBuffer, MAX_FMT_SIZE);
|
||||
GetLocaleInfoW(pGlobalData->lcid,
|
||||
LOCALE_SMONDECIMALSEP,
|
||||
szBuffer, MAX_FMT_SIZE);
|
||||
|
||||
/* Decimal separator */
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYDECSEP),
|
||||
CB_ADDSTRING,
|
||||
0,
|
||||
(LPARAM)szBuffer);
|
||||
SendDlgItemMessageW(hwndDlg, IDC_CURRENCYDECSEP,
|
||||
CB_ADDSTRING,
|
||||
0,
|
||||
(LPARAM)szBuffer);
|
||||
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYDECSEP),
|
||||
CB_SETCURSEL,
|
||||
0, /* Index */
|
||||
0);
|
||||
SendDlgItemMessageW(hwndDlg, IDC_CURRENCYDECSEP,
|
||||
CB_SETCURSEL,
|
||||
0, /* Index */
|
||||
0);
|
||||
}
|
||||
|
||||
|
||||
|
@ -267,38 +267,38 @@ InitCurrencyDecimalSeparators(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
|||
static VOID
|
||||
InitCurrencyNumFracDigits(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
||||
{
|
||||
TCHAR szBuffer[MAX_FMT_SIZE];
|
||||
WCHAR szBuffer[MAX_FMT_SIZE];
|
||||
int ret;
|
||||
int i;
|
||||
|
||||
/* Create standard list of fractional symbols */
|
||||
for (i = 0; i < 10; i++)
|
||||
{
|
||||
szBuffer[0] = _T('0') + i;
|
||||
szBuffer[0] = L'0' + i;
|
||||
szBuffer[1] = 0;
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYDECNUM),
|
||||
CB_ADDSTRING,
|
||||
0,
|
||||
(LPARAM)szBuffer);
|
||||
SendDlgItemMessageW(hwndDlg, IDC_CURRENCYDECNUM,
|
||||
CB_ADDSTRING,
|
||||
0,
|
||||
(LPARAM)szBuffer);
|
||||
}
|
||||
|
||||
/* Get number of fractional digits */
|
||||
ret = GetLocaleInfo(pGlobalData->lcid,
|
||||
LOCALE_ICURRDIGITS,
|
||||
szBuffer, MAX_FMT_SIZE);
|
||||
ret = GetLocaleInfoW(pGlobalData->lcid,
|
||||
LOCALE_ICURRDIGITS,
|
||||
szBuffer, MAX_FMT_SIZE);
|
||||
if (ret != 0)
|
||||
{
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYDECNUM),
|
||||
CB_SETCURSEL,
|
||||
_ttoi(szBuffer),
|
||||
0);
|
||||
SendDlgItemMessageW(hwndDlg, IDC_CURRENCYDECNUM,
|
||||
CB_SETCURSEL,
|
||||
_wtoi(szBuffer),
|
||||
0);
|
||||
}
|
||||
else
|
||||
{
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYDECNUM),
|
||||
CB_SETCURSEL,
|
||||
0,
|
||||
0);
|
||||
SendDlgItemMessageW(hwndDlg, IDC_CURRENCYDECNUM,
|
||||
CB_SETCURSEL,
|
||||
0,
|
||||
0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -307,247 +307,247 @@ InitCurrencyNumFracDigits(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
|||
static VOID
|
||||
InitCurrencyGroupSeparators(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
||||
{
|
||||
TCHAR szBuffer[MAX_FMT_SIZE];
|
||||
WCHAR szBuffer[MAX_FMT_SIZE];
|
||||
|
||||
/* Limit text length */
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYGRPSEP),
|
||||
CB_LIMITTEXT,
|
||||
MAX_CURRENCYGRPSEP,
|
||||
0);
|
||||
SendDlgItemMessageW(hwndDlg, IDC_CURRENCYGRPSEP,
|
||||
CB_LIMITTEXT,
|
||||
MAX_CURRENCYGRPSEP,
|
||||
0);
|
||||
|
||||
/* Get group separator */
|
||||
GetLocaleInfo(pGlobalData->lcid,
|
||||
LOCALE_SMONTHOUSANDSEP,
|
||||
szBuffer, MAX_FMT_SIZE);
|
||||
GetLocaleInfoW(pGlobalData->lcid,
|
||||
LOCALE_SMONTHOUSANDSEP,
|
||||
szBuffer, MAX_FMT_SIZE);
|
||||
|
||||
/* Digit group separator */
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYGRPSEP),
|
||||
CB_ADDSTRING,
|
||||
0,
|
||||
(LPARAM)szBuffer);
|
||||
SendDlgItemMessageW(hwndDlg, IDC_CURRENCYGRPSEP,
|
||||
CB_ADDSTRING,
|
||||
0,
|
||||
(LPARAM)szBuffer);
|
||||
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYGRPSEP),
|
||||
CB_SETCURSEL,
|
||||
0, /* Index */
|
||||
0);
|
||||
SendDlgItemMessageW(hwndDlg, IDC_CURRENCYGRPSEP,
|
||||
CB_SETCURSEL,
|
||||
0, /* Index */
|
||||
0);
|
||||
}
|
||||
|
||||
|
||||
static VOID
|
||||
InitDigitGroupCB(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
||||
{
|
||||
TCHAR szThousandSep[MAX_FMT_SIZE];
|
||||
TCHAR szGrouping[MAX_FMT_SIZE];
|
||||
TCHAR szBuffer[MAX_FMT_SIZE];
|
||||
CURRENCYFMT cyFmt;
|
||||
WCHAR szThousandSep[MAX_FMT_SIZE];
|
||||
WCHAR szGrouping[MAX_FMT_SIZE];
|
||||
WCHAR szBuffer[MAX_FMT_SIZE];
|
||||
CURRENCYFMTW cyFmt;
|
||||
INT i;
|
||||
|
||||
/* Get group separator */
|
||||
GetLocaleInfo(pGlobalData->lcid,
|
||||
LOCALE_SMONTHOUSANDSEP,
|
||||
szThousandSep, MAX_FMT_SIZE);
|
||||
GetLocaleInfoW(pGlobalData->lcid,
|
||||
LOCALE_SMONTHOUSANDSEP,
|
||||
szThousandSep, MAX_FMT_SIZE);
|
||||
|
||||
/* Get grouping */
|
||||
GetLocaleInfo(pGlobalData->lcid,
|
||||
LOCALE_SMONGROUPING,
|
||||
szGrouping, MAX_FMT_SIZE);
|
||||
GetLocaleInfoW(pGlobalData->lcid,
|
||||
LOCALE_SMONGROUPING,
|
||||
szGrouping, MAX_FMT_SIZE);
|
||||
|
||||
/* Digit grouping */
|
||||
cyFmt.NumDigits = 0;
|
||||
cyFmt.LeadingZero = 0;
|
||||
cyFmt.lpDecimalSep = _T("");
|
||||
cyFmt.lpDecimalSep = L"";
|
||||
cyFmt.lpThousandSep = szThousandSep;
|
||||
cyFmt.PositiveOrder = 0;
|
||||
cyFmt.NegativeOrder = 0;
|
||||
cyFmt.lpCurrencySymbol = _T("");
|
||||
cyFmt.lpCurrencySymbol = L"";
|
||||
cyFmt.Grouping = 0;
|
||||
GetCurrencyFormat(pGlobalData->lcid, 0,
|
||||
_T("123456789"),
|
||||
&cyFmt, szBuffer, MAX_FMT_SIZE);
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYGRPNUM),
|
||||
CB_INSERTSTRING,
|
||||
-1,
|
||||
(LPARAM)szBuffer);
|
||||
GetCurrencyFormatW(pGlobalData->lcid, 0,
|
||||
L"123456789",
|
||||
&cyFmt, szBuffer, MAX_FMT_SIZE);
|
||||
SendDlgItemMessageW(hwndDlg, IDC_CURRENCYGRPNUM,
|
||||
CB_INSERTSTRING,
|
||||
-1,
|
||||
(LPARAM)szBuffer);
|
||||
|
||||
cyFmt.Grouping = 3;
|
||||
GetCurrencyFormat(pGlobalData->lcid, 0,
|
||||
_T("123456789"),
|
||||
&cyFmt, szBuffer, MAX_FMT_SIZE);
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYGRPNUM),
|
||||
CB_INSERTSTRING,
|
||||
-1,
|
||||
(LPARAM)szBuffer);
|
||||
GetCurrencyFormatW(pGlobalData->lcid, 0,
|
||||
L"123456789",
|
||||
&cyFmt, szBuffer, MAX_FMT_SIZE);
|
||||
SendDlgItemMessageW(hwndDlg, IDC_CURRENCYGRPNUM,
|
||||
CB_INSERTSTRING,
|
||||
-1,
|
||||
(LPARAM)szBuffer);
|
||||
|
||||
cyFmt.Grouping = 32;
|
||||
GetCurrencyFormat(pGlobalData->lcid, 0,
|
||||
_T("123456789"),
|
||||
&cyFmt, szBuffer, MAX_FMT_SIZE);
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYGRPNUM),
|
||||
CB_INSERTSTRING,
|
||||
-1,
|
||||
(LPARAM)szBuffer);
|
||||
GetCurrencyFormatW(pGlobalData->lcid, 0,
|
||||
L"123456789",
|
||||
&cyFmt, szBuffer, MAX_FMT_SIZE);
|
||||
SendDlgItemMessageW(hwndDlg, IDC_CURRENCYGRPNUM,
|
||||
CB_INSERTSTRING,
|
||||
-1,
|
||||
(LPARAM)szBuffer);
|
||||
|
||||
i = 0;
|
||||
if (szGrouping[0] == _T('3'))
|
||||
if (szGrouping[0] == L'3')
|
||||
{
|
||||
if ((szGrouping[1] == _T(';')) &&
|
||||
(szGrouping[2] == _T('2')))
|
||||
if ((szGrouping[1] == L';') &&
|
||||
(szGrouping[2] == L'2'))
|
||||
i = 2;
|
||||
else
|
||||
i = 1;
|
||||
}
|
||||
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYGRPNUM),
|
||||
CB_SETCURSEL,
|
||||
i, /* Index */
|
||||
0);
|
||||
SendDlgItemMessageW(hwndDlg, IDC_CURRENCYGRPNUM,
|
||||
CB_SETCURSEL,
|
||||
i, /* Index */
|
||||
0);
|
||||
}
|
||||
|
||||
|
||||
/* Set number of digits in field */
|
||||
static BOOL
|
||||
SetCurrencyDigNum(HWND hwndDlg, LCID lcid)
|
||||
SetCurrencyDigNum(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
||||
{
|
||||
LPTSTR szFieldDigNumSamples[MAX_FIELD_DIG_SAMPLES]=
|
||||
PWSTR szFieldDigNumSamples[MAX_FIELD_DIG_SAMPLES]=
|
||||
{
|
||||
_T("0;0"),
|
||||
_T("3;0"),
|
||||
_T("3;2;0")
|
||||
L"0;0",
|
||||
L"3;0",
|
||||
L"3;2;0"
|
||||
};
|
||||
|
||||
int nCurrSel;
|
||||
|
||||
/* Get setted number of digits in field */
|
||||
nCurrSel = SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYGRPNUM),
|
||||
CB_GETCURSEL,
|
||||
(WPARAM)0,
|
||||
(LPARAM)0);
|
||||
nCurrSel = SendDlgItemMessageW(hwndDlg, IDC_CURRENCYGRPNUM,
|
||||
CB_GETCURSEL,
|
||||
(WPARAM)0,
|
||||
(LPARAM)0);
|
||||
|
||||
/* Save number of digits in field */
|
||||
if (nCurrSel != CB_ERR)
|
||||
SetLocaleInfo(lcid, LOCALE_SMONGROUPING, szFieldDigNumSamples[nCurrSel]);
|
||||
SetLocaleInfoW(pGlobalData->lcid, LOCALE_SMONGROUPING, szFieldDigNumSamples[nCurrSel]);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Set currency field separator */
|
||||
static BOOL
|
||||
SetCurrencyFieldSep(HWND hwndDlg, LCID lcid)
|
||||
SetCurrencyFieldSep(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
||||
{
|
||||
TCHAR szCurrencyFieldSep[MAX_SAMPLES_STR_SIZE];
|
||||
WCHAR szCurrencyFieldSep[MAX_SAMPLES_STR_SIZE];
|
||||
|
||||
/* Get setted currency field separator */
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYGRPSEP),
|
||||
WM_GETTEXT,
|
||||
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
||||
(LPARAM)szCurrencyFieldSep);
|
||||
SendDlgItemMessageW(hwndDlg, IDC_CURRENCYGRPSEP,
|
||||
WM_GETTEXT,
|
||||
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
||||
(LPARAM)szCurrencyFieldSep);
|
||||
|
||||
/* Save currency field separator */
|
||||
SetLocaleInfo(lcid, LOCALE_SMONTHOUSANDSEP, szCurrencyFieldSep);
|
||||
SetLocaleInfoW(pGlobalData->lcid, LOCALE_SMONTHOUSANDSEP, szCurrencyFieldSep);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Set number of fractional symbols */
|
||||
static BOOL
|
||||
SetCurrencyFracSymNum(HWND hwndDlg, LCID lcid)
|
||||
SetCurrencyFracSymNum(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
||||
{
|
||||
TCHAR szCurrencyFracSymNum[MAX_SAMPLES_STR_SIZE];
|
||||
WCHAR szCurrencyFracSymNum[MAX_SAMPLES_STR_SIZE];
|
||||
INT nCurrSel;
|
||||
|
||||
/* Get setted number of fractional symbols */
|
||||
nCurrSel = SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYDECNUM),
|
||||
CB_GETCURSEL,
|
||||
(WPARAM)0,
|
||||
(LPARAM)0);
|
||||
nCurrSel = SendDlgItemMessageW(hwndDlg, IDC_CURRENCYDECNUM,
|
||||
CB_GETCURSEL,
|
||||
(WPARAM)0,
|
||||
(LPARAM)0);
|
||||
|
||||
/* Convert to wide char */
|
||||
_itot(nCurrSel, szCurrencyFracSymNum, DECIMAL_RADIX);
|
||||
_itow(nCurrSel, szCurrencyFracSymNum, DECIMAL_RADIX);
|
||||
|
||||
/* Save number of fractional symbols */
|
||||
SetLocaleInfo(lcid, LOCALE_ICURRDIGITS, szCurrencyFracSymNum);
|
||||
SetLocaleInfoW(pGlobalData->lcid, LOCALE_ICURRDIGITS, szCurrencyFracSymNum);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Set currency separator */
|
||||
static BOOL
|
||||
SetCurrencySep(HWND hwndDlg, LCID lcid)
|
||||
SetCurrencySep(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
||||
{
|
||||
TCHAR szCurrencySep[MAX_SAMPLES_STR_SIZE];
|
||||
WCHAR szCurrencySep[MAX_SAMPLES_STR_SIZE];
|
||||
|
||||
/* Get setted currency decimal separator */
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYDECSEP),
|
||||
WM_GETTEXT,
|
||||
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
||||
(LPARAM)szCurrencySep);
|
||||
SendDlgItemMessageW(hwndDlg, IDC_CURRENCYDECSEP,
|
||||
WM_GETTEXT,
|
||||
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
||||
(LPARAM)szCurrencySep);
|
||||
|
||||
/* TODO: Add check for correctly input */
|
||||
|
||||
/* Save currency separator */
|
||||
SetLocaleInfo(lcid, LOCALE_SMONDECIMALSEP, szCurrencySep);
|
||||
SetLocaleInfoW(pGlobalData->lcid, LOCALE_SMONDECIMALSEP, szCurrencySep);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Set negative currency sum format */
|
||||
static BOOL
|
||||
SetNegCurrencySumFmt(HWND hwndDlg, LCID lcid)
|
||||
SetNegCurrencySumFmt(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
||||
{
|
||||
TCHAR szNegCurrencySumFmt[MAX_SAMPLES_STR_SIZE];
|
||||
WCHAR szNegCurrencySumFmt[MAX_SAMPLES_STR_SIZE];
|
||||
INT nCurrSel;
|
||||
|
||||
/* Get setted currency unit */
|
||||
nCurrSel = SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYNEGVALUE),
|
||||
CB_GETCURSEL,
|
||||
(WPARAM)0,
|
||||
(LPARAM)0);
|
||||
nCurrSel = SendDlgItemMessageW(hwndDlg, IDC_CURRENCYNEGVALUE,
|
||||
CB_GETCURSEL,
|
||||
(WPARAM)0,
|
||||
(LPARAM)0);
|
||||
|
||||
/* Convert to wide char */
|
||||
_itot(nCurrSel, szNegCurrencySumFmt, DECIMAL_RADIX);
|
||||
_itow(nCurrSel, szNegCurrencySumFmt, DECIMAL_RADIX);
|
||||
|
||||
/* Save currency sum format */
|
||||
SetLocaleInfo(lcid, LOCALE_INEGCURR, szNegCurrencySumFmt);
|
||||
SetLocaleInfoW(pGlobalData->lcid, LOCALE_INEGCURR, szNegCurrencySumFmt);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Set positive currency sum format */
|
||||
static BOOL
|
||||
SetPosCurrencySumFmt(HWND hwndDlg, LCID lcid)
|
||||
SetPosCurrencySumFmt(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
||||
{
|
||||
TCHAR szPosCurrencySumFmt[MAX_SAMPLES_STR_SIZE];
|
||||
WCHAR szPosCurrencySumFmt[MAX_SAMPLES_STR_SIZE];
|
||||
INT nCurrSel;
|
||||
|
||||
/* Get setted currency unit */
|
||||
nCurrSel = SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYPOSVALUE),
|
||||
CB_GETCURSEL,
|
||||
(WPARAM)0,
|
||||
(LPARAM)0);
|
||||
nCurrSel = SendDlgItemMessageW(hwndDlg, IDC_CURRENCYPOSVALUE,
|
||||
CB_GETCURSEL,
|
||||
(WPARAM)0,
|
||||
(LPARAM)0);
|
||||
|
||||
/* Convert to wide char */
|
||||
_itot(nCurrSel, szPosCurrencySumFmt, DECIMAL_RADIX);
|
||||
_itow(nCurrSel, szPosCurrencySumFmt, DECIMAL_RADIX);
|
||||
|
||||
/* Save currency sum format */
|
||||
SetLocaleInfo(lcid, LOCALE_ICURRENCY, szPosCurrencySumFmt);
|
||||
SetLocaleInfoW(pGlobalData->lcid, LOCALE_ICURRENCY, szPosCurrencySumFmt);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Set currency unit */
|
||||
static BOOL
|
||||
SetCurrencyUnit(HWND hwndDlg, LCID lcid)
|
||||
SetCurrencyUnit(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
||||
{
|
||||
TCHAR szCurrencyUnit[MAX_SAMPLES_STR_SIZE];
|
||||
WCHAR szCurrencyUnit[MAX_SAMPLES_STR_SIZE];
|
||||
|
||||
/* Get setted currency unit */
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYSYMBOL),
|
||||
WM_GETTEXT,
|
||||
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
||||
(LPARAM)(LPCSTR)szCurrencyUnit);
|
||||
SendDlgItemMessageW(hwndDlg, IDC_CURRENCYSYMBOL,
|
||||
WM_GETTEXT,
|
||||
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
||||
(LPARAM)(PCWSTR)szCurrencyUnit);
|
||||
|
||||
/* Save currency unit */
|
||||
SetLocaleInfo(lcid, LOCALE_SCURRENCY, szCurrencyUnit);
|
||||
SetLocaleInfoW(pGlobalData->lcid, LOCALE_SCURRENCY, szCurrencyUnit);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -603,25 +603,25 @@ CurrencyPageProc(HWND hwndDlg,
|
|||
/* If push apply button */
|
||||
if (lpnm->code == (UINT)PSN_APPLY)
|
||||
{
|
||||
if (!SetCurrencyDigNum(hwndDlg, pGlobalData->lcid))
|
||||
if (!SetCurrencyDigNum(hwndDlg, pGlobalData))
|
||||
break;
|
||||
|
||||
if (!SetCurrencyUnit(hwndDlg, pGlobalData->lcid))
|
||||
if (!SetCurrencyUnit(hwndDlg, pGlobalData))
|
||||
break;
|
||||
|
||||
if (!SetPosCurrencySumFmt(hwndDlg, pGlobalData->lcid))
|
||||
if (!SetPosCurrencySumFmt(hwndDlg, pGlobalData))
|
||||
break;
|
||||
|
||||
if (!SetNegCurrencySumFmt(hwndDlg, pGlobalData->lcid))
|
||||
if (!SetNegCurrencySumFmt(hwndDlg, pGlobalData))
|
||||
break;
|
||||
|
||||
if (!SetCurrencySep(hwndDlg, pGlobalData->lcid))
|
||||
if (!SetCurrencySep(hwndDlg, pGlobalData))
|
||||
break;
|
||||
|
||||
if (!SetCurrencyFracSymNum(hwndDlg, pGlobalData->lcid))
|
||||
if (!SetCurrencyFracSymNum(hwndDlg, pGlobalData))
|
||||
break;
|
||||
|
||||
if (!SetCurrencyFieldSep(hwndDlg, pGlobalData->lcid))
|
||||
if (!SetCurrencyFieldSep(hwndDlg, pGlobalData))
|
||||
break;
|
||||
|
||||
UpdateExamples(hwndDlg, pGlobalData);
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
#define YEAR_STR_MAX_SIZE 5
|
||||
#define MAX_SHRT_DATE_SEPARATORS 3
|
||||
#define STD_DATE_SEP _T(".")
|
||||
#define STD_DATE_SEP L"."
|
||||
#define YEAR_DIFF (99)
|
||||
#define MAX_YEAR (9999)
|
||||
|
||||
|
@ -39,9 +39,9 @@ static HWND hwndEnum = NULL;
|
|||
|
||||
/* If char is 'y' or 'M' or 'd' return TRUE, else FALSE */
|
||||
BOOL
|
||||
isDateCompAl(TCHAR alpha)
|
||||
isDateCompAl(WCHAR alpha)
|
||||
{
|
||||
if ((alpha == _T('y')) || (alpha == _T('M')) || (alpha == _T('d')) || (alpha == _T(' ')))
|
||||
if ((alpha == L'y') || (alpha == L'M') || (alpha == L'd') || (alpha == L' '))
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
|
@ -49,30 +49,30 @@ isDateCompAl(TCHAR alpha)
|
|||
|
||||
/* Find first date separator in string */
|
||||
LPTSTR
|
||||
FindDateSep(const TCHAR *szSourceStr)
|
||||
FindDateSep(const WCHAR *szSourceStr)
|
||||
{
|
||||
LPTSTR pszFoundSep;
|
||||
PWSTR pszFoundSep;
|
||||
UINT nDateCompCount=0;
|
||||
UINT nDateSepCount=0;
|
||||
|
||||
pszFoundSep = (LPTSTR)malloc(MAX_SAMPLES_STR_SIZE * sizeof(TCHAR));
|
||||
pszFoundSep = (LPWSTR)malloc(MAX_SAMPLES_STR_SIZE * sizeof(WCHAR));
|
||||
|
||||
if(!pszFoundSep)
|
||||
return NULL;
|
||||
|
||||
_tcscpy(pszFoundSep,STD_DATE_SEP);
|
||||
wcscpy(pszFoundSep,STD_DATE_SEP);
|
||||
|
||||
while (nDateCompCount < _tcslen(szSourceStr))
|
||||
while (nDateCompCount < wcslen(szSourceStr))
|
||||
{
|
||||
if (!isDateCompAl(szSourceStr[nDateCompCount]) && (szSourceStr[nDateCompCount] != _T('\'')))
|
||||
if (!isDateCompAl(szSourceStr[nDateCompCount]) && (szSourceStr[nDateCompCount] != L'\''))
|
||||
{
|
||||
while (!isDateCompAl(szSourceStr[nDateCompCount]) && (szSourceStr[nDateCompCount] != _T('\'')))
|
||||
while (!isDateCompAl(szSourceStr[nDateCompCount]) && (szSourceStr[nDateCompCount] != L'\''))
|
||||
{
|
||||
pszFoundSep[nDateSepCount++] = szSourceStr[nDateCompCount];
|
||||
nDateCompCount++;
|
||||
}
|
||||
|
||||
pszFoundSep[nDateSepCount] = _T('\0');
|
||||
pszFoundSep[nDateSepCount] = L'\0';
|
||||
return pszFoundSep;
|
||||
}
|
||||
|
||||
|
@ -87,25 +87,25 @@ FindDateSep(const TCHAR *szSourceStr)
|
|||
|
||||
/* Setted up short date separator to registry */
|
||||
static BOOL
|
||||
SetShortDateSep(HWND hwndDlg, LCID lcid)
|
||||
SetShortDateSep(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
||||
{
|
||||
TCHAR szShortDateSep[MAX_SAMPLES_STR_SIZE];
|
||||
WCHAR szShortDateSep[MAX_SAMPLES_STR_SIZE];
|
||||
INT nSepStrSize;
|
||||
INT nSepCount;
|
||||
|
||||
/* Get setted separator */
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_SHRTDATESEP_COMBO),
|
||||
WM_GETTEXT,
|
||||
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
||||
(LPARAM)szShortDateSep);
|
||||
SendDlgItemMessageW(hwndDlg, IDC_SHRTDATESEP_COMBO,
|
||||
WM_GETTEXT,
|
||||
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
||||
(LPARAM)szShortDateSep);
|
||||
|
||||
/* Get setted separator string size */
|
||||
nSepStrSize = _tcslen(szShortDateSep);
|
||||
nSepStrSize = wcslen(szShortDateSep);
|
||||
|
||||
/* Check date components */
|
||||
for (nSepCount = 0; nSepCount < nSepStrSize; nSepCount++)
|
||||
{
|
||||
if (_istalnum(szShortDateSep[nSepCount]) || (szShortDateSep[nSepCount] == _T('\'')))
|
||||
if (iswalnum(szShortDateSep[nSepCount]) || (szShortDateSep[nSepCount] == L'\''))
|
||||
{
|
||||
PrintErrorMsgBox(IDS_ERROR_SYMBOL_SEPARATE);
|
||||
return FALSE;
|
||||
|
@ -113,48 +113,48 @@ SetShortDateSep(HWND hwndDlg, LCID lcid)
|
|||
}
|
||||
|
||||
/* Save date separator */
|
||||
SetLocaleInfo(lcid, LOCALE_SDATE, szShortDateSep);
|
||||
SetLocaleInfoW(pGlobalData->lcid, LOCALE_SDATE, szShortDateSep);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Setted up short date format to registry */
|
||||
static BOOL
|
||||
SetShortDateFormat(HWND hwndDlg, LCID lcid)
|
||||
SetShortDateFormat(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
||||
{
|
||||
TCHAR szShortDateFmt[MAX_SAMPLES_STR_SIZE];
|
||||
TCHAR szShortDateSep[MAX_SAMPLES_STR_SIZE];
|
||||
TCHAR szFoundDateSep[MAX_SAMPLES_STR_SIZE];
|
||||
LPTSTR pszResultStr;
|
||||
LPTSTR pszFoundSep;
|
||||
WCHAR szShortDateFmt[MAX_SAMPLES_STR_SIZE];
|
||||
WCHAR szShortDateSep[MAX_SAMPLES_STR_SIZE];
|
||||
WCHAR szFoundDateSep[MAX_SAMPLES_STR_SIZE];
|
||||
PWSTR pszResultStr;
|
||||
PWSTR pszFoundSep;
|
||||
BOOL OpenApostFlg = FALSE;
|
||||
INT nFmtStrSize;
|
||||
INT nDateCompCount;
|
||||
|
||||
/* Get setted format */
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_SHRTDATEFMT_COMBO),
|
||||
WM_GETTEXT,
|
||||
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
||||
(LPARAM)szShortDateFmt);
|
||||
SendDlgItemMessageW(hwndDlg, IDC_SHRTDATEFMT_COMBO,
|
||||
WM_GETTEXT,
|
||||
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
||||
(LPARAM)szShortDateFmt);
|
||||
|
||||
/* Get setted separator */
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_SHRTDATESEP_COMBO),
|
||||
WM_GETTEXT,
|
||||
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
||||
(LPARAM)szShortDateSep);
|
||||
SendDlgItemMessageW(hwndDlg, IDC_SHRTDATESEP_COMBO,
|
||||
WM_GETTEXT,
|
||||
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
||||
(LPARAM)szShortDateSep);
|
||||
|
||||
/* Get setted format-string size */
|
||||
nFmtStrSize = _tcslen(szShortDateFmt);
|
||||
nFmtStrSize = wcslen(szShortDateFmt);
|
||||
|
||||
/* Check date components */
|
||||
for (nDateCompCount = 0; nDateCompCount < nFmtStrSize; nDateCompCount++)
|
||||
{
|
||||
if (szShortDateFmt[nDateCompCount] == _T('\''))
|
||||
if (szShortDateFmt[nDateCompCount] == L'\'')
|
||||
{
|
||||
OpenApostFlg = !OpenApostFlg;
|
||||
}
|
||||
|
||||
if (_istalnum(szShortDateFmt[nDateCompCount]) &&
|
||||
if (iswalnum(szShortDateFmt[nDateCompCount]) &&
|
||||
!isDateCompAl(szShortDateFmt[nDateCompCount]) &&
|
||||
!OpenApostFlg)
|
||||
{
|
||||
|
@ -173,47 +173,47 @@ SetShortDateFormat(HWND hwndDlg, LCID lcid)
|
|||
pszFoundSep = FindDateSep(szShortDateFmt);
|
||||
|
||||
/* Substring replacement of separator */
|
||||
_tcscpy(szFoundDateSep, pszFoundSep);
|
||||
wcscpy(szFoundDateSep, pszFoundSep);
|
||||
pszResultStr = ReplaceSubStr(szShortDateFmt, szShortDateSep, szFoundDateSep);
|
||||
_tcscpy(szShortDateFmt, pszResultStr);
|
||||
wcscpy(szShortDateFmt, pszResultStr);
|
||||
free(pszResultStr);
|
||||
|
||||
if(pszFoundSep)
|
||||
free(pszFoundSep);
|
||||
|
||||
/* Save short date format */
|
||||
SetLocaleInfo(lcid, LOCALE_SSHORTDATE, szShortDateFmt);
|
||||
SetLocaleInfoW(pGlobalData->lcid, LOCALE_SSHORTDATE, szShortDateFmt);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Setted up long date format to registry */
|
||||
static BOOL
|
||||
SetLongDateFormat(HWND hwndDlg, LCID lcid)
|
||||
SetLongDateFormat(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
||||
{
|
||||
TCHAR szLongDateFmt[MAX_SAMPLES_STR_SIZE];
|
||||
WCHAR szLongDateFmt[MAX_SAMPLES_STR_SIZE];
|
||||
BOOL OpenApostFlg = FALSE;
|
||||
INT nFmtStrSize;
|
||||
INT nDateCompCount;
|
||||
|
||||
/* Get setted format */
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_LONGDATEFMT_COMBO),
|
||||
WM_GETTEXT,
|
||||
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
||||
(LPARAM)szLongDateFmt);
|
||||
SendDlgItemMessageW(hwndDlg, IDC_LONGDATEFMT_COMBO,
|
||||
WM_GETTEXT,
|
||||
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
||||
(LPARAM)szLongDateFmt);
|
||||
|
||||
/* Get setted format string size */
|
||||
nFmtStrSize = _tcslen(szLongDateFmt);
|
||||
nFmtStrSize = wcslen(szLongDateFmt);
|
||||
|
||||
/* Check date components */
|
||||
for (nDateCompCount = 0; nDateCompCount < nFmtStrSize; nDateCompCount++)
|
||||
{
|
||||
if (szLongDateFmt[nDateCompCount] == _T('\''))
|
||||
if (szLongDateFmt[nDateCompCount] == L'\'')
|
||||
{
|
||||
OpenApostFlg = !OpenApostFlg;
|
||||
}
|
||||
|
||||
if (_istalnum(szLongDateFmt[nDateCompCount]) &&
|
||||
if (iswalnum(szLongDateFmt[nDateCompCount]) &&
|
||||
!isDateCompAl(szLongDateFmt[nDateCompCount]) &&
|
||||
!OpenApostFlg)
|
||||
{
|
||||
|
@ -230,176 +230,176 @@ SetLongDateFormat(HWND hwndDlg, LCID lcid)
|
|||
}
|
||||
|
||||
/* Save short date format */
|
||||
SetLocaleInfo(lcid, LOCALE_SLONGDATE, szLongDateFmt);
|
||||
SetLocaleInfoW(pGlobalData->lcid, LOCALE_SLONGDATE, szLongDateFmt);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Init short date separator control box */
|
||||
static VOID
|
||||
InitShortDateSepSamples(HWND hwndDlg, LCID lcid)
|
||||
InitShortDateSepSamples(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
||||
{
|
||||
LPTSTR ShortDateSepSamples[MAX_SHRT_DATE_SEPARATORS] =
|
||||
PWSTR ShortDateSepSamples[MAX_SHRT_DATE_SEPARATORS] =
|
||||
{
|
||||
_T("."),
|
||||
_T("/"),
|
||||
_T("-")
|
||||
L".",
|
||||
L"/",
|
||||
L"-"
|
||||
};
|
||||
TCHAR szShortDateSep[MAX_SAMPLES_STR_SIZE];
|
||||
WCHAR szShortDateSep[MAX_SAMPLES_STR_SIZE];
|
||||
INT nCBIndex;
|
||||
INT nRetCode;
|
||||
|
||||
/* Get current short date separator */
|
||||
GetLocaleInfo(lcid,
|
||||
LOCALE_SDATE,
|
||||
szShortDateSep,
|
||||
MAX_SAMPLES_STR_SIZE);
|
||||
GetLocaleInfoW(pGlobalData->lcid,
|
||||
LOCALE_SDATE,
|
||||
szShortDateSep,
|
||||
MAX_SAMPLES_STR_SIZE);
|
||||
|
||||
/* Clear all box content */
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_SHRTDATESEP_COMBO),
|
||||
CB_RESETCONTENT,
|
||||
(WPARAM)0,
|
||||
(LPARAM)0);
|
||||
SendDlgItemMessageW(hwndDlg, IDC_SHRTDATESEP_COMBO,
|
||||
CB_RESETCONTENT,
|
||||
(WPARAM)0,
|
||||
(LPARAM)0);
|
||||
|
||||
/* Create standard list of separators */
|
||||
for (nCBIndex = 0; nCBIndex < MAX_SHRT_DATE_SEPARATORS; nCBIndex++)
|
||||
{
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_SHRTDATESEP_COMBO),
|
||||
CB_ADDSTRING,
|
||||
0,
|
||||
(LPARAM)ShortDateSepSamples[nCBIndex]);
|
||||
SendDlgItemMessageW(hwndDlg, IDC_SHRTDATESEP_COMBO,
|
||||
CB_ADDSTRING,
|
||||
0,
|
||||
(LPARAM)ShortDateSepSamples[nCBIndex]);
|
||||
}
|
||||
|
||||
/* Set current item to value from registry */
|
||||
nRetCode = SendMessage(GetDlgItem(hwndDlg, IDC_SHRTDATESEP_COMBO),
|
||||
CB_SELECTSTRING,
|
||||
-1,
|
||||
(LPARAM)szShortDateSep);
|
||||
nRetCode = SendDlgItemMessageW(hwndDlg, IDC_SHRTDATESEP_COMBO,
|
||||
CB_SELECTSTRING,
|
||||
-1,
|
||||
(LPARAM)szShortDateSep);
|
||||
|
||||
/* If it is not successful, add new value to list and select them */
|
||||
if (nRetCode == CB_ERR)
|
||||
{
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_SHRTDATESEP_COMBO),
|
||||
CB_ADDSTRING,
|
||||
0,
|
||||
(LPARAM)szShortDateSep);
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_SHRTDATESEP_COMBO),
|
||||
CB_SELECTSTRING,
|
||||
-1,
|
||||
(LPARAM)szShortDateSep);
|
||||
SendDlgItemMessageW(hwndDlg, IDC_SHRTDATESEP_COMBO,
|
||||
CB_ADDSTRING,
|
||||
0,
|
||||
(LPARAM)szShortDateSep);
|
||||
SendDlgItemMessageW(hwndDlg, IDC_SHRTDATESEP_COMBO,
|
||||
CB_SELECTSTRING,
|
||||
-1,
|
||||
(LPARAM)szShortDateSep);
|
||||
}
|
||||
}
|
||||
|
||||
static BOOL CALLBACK
|
||||
ShortDateFormatEnumProc(LPTSTR lpTimeFormatString)
|
||||
ShortDateFormatEnumProc(PWSTR lpTimeFormatString)
|
||||
{
|
||||
SendMessage(hwndEnum,
|
||||
CB_ADDSTRING,
|
||||
0,
|
||||
(LPARAM)lpTimeFormatString);
|
||||
SendMessageW(hwndEnum,
|
||||
CB_ADDSTRING,
|
||||
0,
|
||||
(LPARAM)lpTimeFormatString);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Init short date control box */
|
||||
VOID
|
||||
InitShortDateCB(HWND hwndDlg, LCID lcid)
|
||||
InitShortDateCB(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
||||
{
|
||||
TCHAR szShortDateFmt[MAX_SAMPLES_STR_SIZE];
|
||||
WCHAR szShortDateFmt[MAX_SAMPLES_STR_SIZE];
|
||||
INT nRetCode;
|
||||
|
||||
/* Limit text lengths */
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_SHRTDATEFMT_COMBO),
|
||||
CB_LIMITTEXT,
|
||||
MAX_SHRTDATEFMT,
|
||||
0);
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_SHRTDATESEP_COMBO),
|
||||
CB_LIMITTEXT,
|
||||
MAX_SHRTDATESEP,
|
||||
0);
|
||||
SendDlgItemMessageW(hwndDlg, IDC_SHRTDATEFMT_COMBO,
|
||||
CB_LIMITTEXT,
|
||||
MAX_SHRTDATEFMT,
|
||||
0);
|
||||
SendDlgItemMessageW(hwndDlg, IDC_SHRTDATESEP_COMBO,
|
||||
CB_LIMITTEXT,
|
||||
MAX_SHRTDATESEP,
|
||||
0);
|
||||
|
||||
/* Get current short date format */
|
||||
GetLocaleInfo(lcid,
|
||||
LOCALE_SSHORTDATE,
|
||||
szShortDateFmt,
|
||||
MAX_SAMPLES_STR_SIZE);
|
||||
GetLocaleInfoW(pGlobalData->lcid,
|
||||
LOCALE_SSHORTDATE,
|
||||
szShortDateFmt,
|
||||
MAX_SAMPLES_STR_SIZE);
|
||||
|
||||
/* Clear all box content */
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_SHRTDATEFMT_COMBO),
|
||||
CB_RESETCONTENT,
|
||||
(WPARAM)0,
|
||||
(LPARAM)0);
|
||||
SendDlgItemMessageW(hwndDlg, IDC_SHRTDATEFMT_COMBO,
|
||||
CB_RESETCONTENT,
|
||||
(WPARAM)0,
|
||||
(LPARAM)0);
|
||||
|
||||
/* Enumerate short date formats */
|
||||
hwndEnum = GetDlgItem(hwndDlg, IDC_SHRTDATEFMT_COMBO);
|
||||
EnumDateFormats(ShortDateFormatEnumProc, lcid, DATE_SHORTDATE);
|
||||
EnumDateFormatsW(ShortDateFormatEnumProc, pGlobalData->lcid, DATE_SHORTDATE);
|
||||
|
||||
/* Set current item to value from registry */
|
||||
nRetCode = SendMessage(GetDlgItem(hwndDlg, IDC_SHRTDATEFMT_COMBO),
|
||||
CB_SELECTSTRING,
|
||||
-1,
|
||||
(LPARAM)szShortDateFmt);
|
||||
nRetCode = SendDlgItemMessageW(hwndDlg, IDC_SHRTDATEFMT_COMBO,
|
||||
CB_SELECTSTRING,
|
||||
-1,
|
||||
(LPARAM)szShortDateFmt);
|
||||
|
||||
/* If it is not successful, add new value to list and select them */
|
||||
if (nRetCode == CB_ERR)
|
||||
{
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_SHRTDATEFMT_COMBO),
|
||||
CB_ADDSTRING,
|
||||
0,
|
||||
(LPARAM)szShortDateFmt);
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_SHRTDATEFMT_COMBO),
|
||||
CB_SELECTSTRING,
|
||||
-1,
|
||||
(LPARAM)szShortDateFmt);
|
||||
SendDlgItemMessageW(hwndDlg, IDC_SHRTDATEFMT_COMBO,
|
||||
CB_ADDSTRING,
|
||||
0,
|
||||
(LPARAM)szShortDateFmt);
|
||||
SendDlgItemMessageW(hwndDlg, IDC_SHRTDATEFMT_COMBO,
|
||||
CB_SELECTSTRING,
|
||||
-1,
|
||||
(LPARAM)szShortDateFmt);
|
||||
}
|
||||
}
|
||||
|
||||
/* Init long date control box */
|
||||
static VOID
|
||||
InitLongDateCB(HWND hwndDlg, LCID lcid)
|
||||
InitLongDateCB(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
||||
{
|
||||
TCHAR szLongDateFmt[MAX_SAMPLES_STR_SIZE];
|
||||
WCHAR szLongDateFmt[MAX_SAMPLES_STR_SIZE];
|
||||
INT nRetCode;
|
||||
|
||||
/* Limit text length */
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_LONGDATEFMT_COMBO),
|
||||
CB_LIMITTEXT,
|
||||
MAX_LONGDATEFMT,
|
||||
0);
|
||||
SendDlgItemMessageW(hwndDlg, IDC_LONGDATEFMT_COMBO,
|
||||
CB_LIMITTEXT,
|
||||
MAX_LONGDATEFMT,
|
||||
0);
|
||||
|
||||
/* Get current long date format */
|
||||
GetLocaleInfo(lcid,
|
||||
LOCALE_SLONGDATE,
|
||||
szLongDateFmt,
|
||||
MAX_SAMPLES_STR_SIZE);
|
||||
GetLocaleInfoW(pGlobalData->lcid,
|
||||
LOCALE_SLONGDATE,
|
||||
szLongDateFmt,
|
||||
MAX_SAMPLES_STR_SIZE);
|
||||
|
||||
/* Clear all box content */
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_LONGDATEFMT_COMBO),
|
||||
CB_RESETCONTENT,
|
||||
(WPARAM)0,
|
||||
(LPARAM)0);
|
||||
SendDlgItemMessageW(hwndDlg, IDC_LONGDATEFMT_COMBO,
|
||||
CB_RESETCONTENT,
|
||||
(WPARAM)0,
|
||||
(LPARAM)0);
|
||||
|
||||
/* Enumerate short long formats */
|
||||
hwndEnum = GetDlgItem(hwndDlg, IDC_LONGDATEFMT_COMBO);
|
||||
EnumDateFormats(ShortDateFormatEnumProc, lcid, DATE_LONGDATE);
|
||||
EnumDateFormatsW(ShortDateFormatEnumProc, pGlobalData->lcid, DATE_LONGDATE);
|
||||
|
||||
/* Set current item to value from registry */
|
||||
nRetCode = SendMessage(GetDlgItem(hwndDlg, IDC_LONGDATEFMT_COMBO),
|
||||
CB_SELECTSTRING,
|
||||
-1,
|
||||
(LPARAM)szLongDateFmt);
|
||||
nRetCode = SendDlgItemMessageW(hwndDlg, IDC_LONGDATEFMT_COMBO,
|
||||
CB_SELECTSTRING,
|
||||
-1,
|
||||
(LPARAM)szLongDateFmt);
|
||||
|
||||
/* If it is not successful, add new value to list and select them */
|
||||
if (nRetCode == CB_ERR)
|
||||
{
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_LONGDATEFMT_COMBO),
|
||||
CB_ADDSTRING,
|
||||
0,
|
||||
(LPARAM)szLongDateFmt);
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_LONGDATEFMT_COMBO),
|
||||
CB_SELECTSTRING,
|
||||
-1,
|
||||
(LPARAM)szLongDateFmt);
|
||||
SendDlgItemMessageW(hwndDlg, IDC_LONGDATEFMT_COMBO,
|
||||
CB_ADDSTRING,
|
||||
0,
|
||||
(LPARAM)szLongDateFmt);
|
||||
SendDlgItemMessageW(hwndDlg, IDC_LONGDATEFMT_COMBO,
|
||||
CB_SELECTSTRING,
|
||||
-1,
|
||||
(LPARAM)szLongDateFmt);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -407,26 +407,26 @@ InitLongDateCB(HWND hwndDlg, LCID lcid)
|
|||
static VOID
|
||||
SetMaxDate(HWND hwndDlg, LCID lcid)
|
||||
{
|
||||
TCHAR szMaxDateVal[YEAR_STR_MAX_SIZE];
|
||||
WCHAR szMaxDateVal[YEAR_STR_MAX_SIZE];
|
||||
HWND hWndYearSpin;
|
||||
INT nSpinVal;
|
||||
|
||||
hWndYearSpin = GetDlgItem(hwndDlg, IDC_SCR_MAX_YEAR);
|
||||
|
||||
/* Get spin value */
|
||||
nSpinVal=LOWORD(SendMessage(hWndYearSpin,
|
||||
nSpinVal=LOWORD(SendMessageW(hWndYearSpin,
|
||||
UDM_GETPOS,
|
||||
0,
|
||||
0));
|
||||
|
||||
/* convert to wide char */
|
||||
_itot(nSpinVal, szMaxDateVal, DECIMAL_RADIX);
|
||||
_itow(nSpinVal, szMaxDateVal, DECIMAL_RADIX);
|
||||
|
||||
/* Save max date value */
|
||||
SetCalendarInfo(lcid,
|
||||
SetCalendarInfoW(lcid,
|
||||
CAL_GREGORIAN,
|
||||
48 , /* CAL_ITWODIGITYEARMAX */
|
||||
(LPCTSTR)szMaxDateVal);
|
||||
(PCWSTR)szMaxDateVal);
|
||||
}
|
||||
|
||||
/* Get max date value from registry set */
|
||||
|
@ -435,12 +435,12 @@ GetMaxDate(LCID lcid)
|
|||
{
|
||||
INT nMaxDateVal = 0;
|
||||
|
||||
GetCalendarInfo(lcid,
|
||||
CAL_GREGORIAN,
|
||||
CAL_ITWODIGITYEARMAX | CAL_RETURN_NUMBER,
|
||||
NULL,
|
||||
0, /* ret type - number */
|
||||
(LPDWORD)&nMaxDateVal);
|
||||
GetCalendarInfoW(lcid,
|
||||
CAL_GREGORIAN,
|
||||
CAL_ITWODIGITYEARMAX | CAL_RETURN_NUMBER,
|
||||
NULL,
|
||||
0, /* ret type - number */
|
||||
(LPDWORD)&nMaxDateVal);
|
||||
|
||||
return nMaxDateVal;
|
||||
}
|
||||
|
@ -449,39 +449,39 @@ GetMaxDate(LCID lcid)
|
|||
static VOID
|
||||
SetMinData(HWND hwndDlg)
|
||||
{
|
||||
TCHAR OutBuffer[YEAR_STR_MAX_SIZE];
|
||||
WCHAR OutBuffer[YEAR_STR_MAX_SIZE];
|
||||
HWND hWndYearSpin;
|
||||
INT nSpinVal;
|
||||
|
||||
hWndYearSpin = GetDlgItem(hwndDlg, IDC_SCR_MAX_YEAR);
|
||||
|
||||
/* Get spin value */
|
||||
nSpinVal = LOWORD(SendMessage(hWndYearSpin,
|
||||
UDM_GETPOS,
|
||||
0,
|
||||
0));
|
||||
nSpinVal = LOWORD(SendMessageW(hWndYearSpin,
|
||||
UDM_GETPOS,
|
||||
0,
|
||||
0));
|
||||
|
||||
/* Set min year value */
|
||||
wsprintf(OutBuffer, _T("%d"), (DWORD)nSpinVal - YEAR_DIFF);
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_FIRSTYEAR_EDIT),
|
||||
WM_SETTEXT,
|
||||
0,
|
||||
(LPARAM)OutBuffer);
|
||||
wsprintf(OutBuffer, L"%d", (DWORD)nSpinVal - YEAR_DIFF);
|
||||
SendDlgItemMessageW(hwndDlg, IDC_FIRSTYEAR_EDIT,
|
||||
WM_SETTEXT,
|
||||
0,
|
||||
(LPARAM)OutBuffer);
|
||||
}
|
||||
|
||||
/* Init spin control */
|
||||
static VOID
|
||||
InitMinMaxDateSpin(HWND hwndDlg, LCID lcid)
|
||||
InitMinMaxDateSpin(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
||||
{
|
||||
TCHAR OutBuffer[YEAR_STR_MAX_SIZE];
|
||||
WCHAR OutBuffer[YEAR_STR_MAX_SIZE];
|
||||
HWND hWndYearSpin;
|
||||
|
||||
/* Limit text lengths */
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_FIRSTYEAR_EDIT),
|
||||
SendDlgItemMessageW(hwndDlg, IDC_FIRSTYEAR_EDIT,
|
||||
EM_LIMITTEXT,
|
||||
MAX_YEAR_EDIT,
|
||||
0);
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_SECONDYEAR_EDIT),
|
||||
SendDlgItemMessageW(hwndDlg, IDC_SECONDYEAR_EDIT,
|
||||
EM_LIMITTEXT,
|
||||
MAX_YEAR_EDIT,
|
||||
0);
|
||||
|
@ -489,51 +489,51 @@ InitMinMaxDateSpin(HWND hwndDlg, LCID lcid)
|
|||
hWndYearSpin = GetDlgItem(hwndDlg, IDC_SCR_MAX_YEAR);
|
||||
|
||||
/* Init max date value */
|
||||
wsprintf(OutBuffer, _T("%04d"), (DWORD)GetMaxDate(lcid));
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_SECONDYEAR_EDIT),
|
||||
WM_SETTEXT,
|
||||
0,
|
||||
(LPARAM)OutBuffer);
|
||||
wsprintf(OutBuffer, L"%04d", (DWORD)GetMaxDate(pGlobalData->lcid));
|
||||
SendDlgItemMessageW(hwndDlg, IDC_SECONDYEAR_EDIT,
|
||||
WM_SETTEXT,
|
||||
0,
|
||||
(LPARAM)OutBuffer);
|
||||
|
||||
/* Init min date value */
|
||||
wsprintf(OutBuffer, _T("%04d"), (DWORD)GetMaxDate(lcid) - YEAR_DIFF);
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_FIRSTYEAR_EDIT),
|
||||
WM_SETTEXT,
|
||||
0,
|
||||
(LPARAM)OutBuffer);
|
||||
wsprintf(OutBuffer, L"%04d", (DWORD)GetMaxDate(pGlobalData->lcid) - YEAR_DIFF);
|
||||
SendDlgItemMessageW(hwndDlg, IDC_FIRSTYEAR_EDIT,
|
||||
WM_SETTEXT,
|
||||
0,
|
||||
(LPARAM)OutBuffer);
|
||||
|
||||
/* Init updown control */
|
||||
/* Set bounds */
|
||||
SendMessage(hWndYearSpin,
|
||||
UDM_SETRANGE,
|
||||
0,
|
||||
MAKELONG(MAX_YEAR,YEAR_DIFF));
|
||||
SendMessageW(hWndYearSpin,
|
||||
UDM_SETRANGE,
|
||||
0,
|
||||
MAKELONG(MAX_YEAR,YEAR_DIFF));
|
||||
|
||||
/* Set current value */
|
||||
SendMessage(hWndYearSpin,
|
||||
UDM_SETPOS,
|
||||
0,
|
||||
MAKELONG(GetMaxDate(lcid),0));
|
||||
SendMessageW(hWndYearSpin,
|
||||
UDM_SETPOS,
|
||||
0,
|
||||
MAKELONG(GetMaxDate(pGlobalData->lcid),0));
|
||||
}
|
||||
|
||||
/* Update all date locale samples */
|
||||
static VOID
|
||||
UpdateDateLocaleSamples(HWND hwndDlg,
|
||||
LCID lcidLocale)
|
||||
PGLOBALDATA pGlobalData)
|
||||
{
|
||||
TCHAR OutBuffer[MAX_SAMPLES_STR_SIZE];
|
||||
WCHAR OutBuffer[MAX_SAMPLES_STR_SIZE];
|
||||
|
||||
/* Get short date format sample */
|
||||
GetDateFormat(lcidLocale, DATE_SHORTDATE, NULL, NULL, OutBuffer,
|
||||
MAX_SAMPLES_STR_SIZE);
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_SHRTDATESAMPLE_EDIT), WM_SETTEXT,
|
||||
0, (LPARAM)OutBuffer);
|
||||
GetDateFormatW(pGlobalData->lcid, DATE_SHORTDATE, NULL, NULL, OutBuffer,
|
||||
MAX_SAMPLES_STR_SIZE);
|
||||
SendDlgItemMessageW(hwndDlg, IDC_SHRTDATESAMPLE_EDIT, WM_SETTEXT,
|
||||
0, (LPARAM)OutBuffer);
|
||||
|
||||
/* Get long date sample */
|
||||
GetDateFormat(lcidLocale, DATE_LONGDATE, NULL, NULL, OutBuffer,
|
||||
MAX_SAMPLES_STR_SIZE);
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_LONGDATESAMPLE_EDIT),
|
||||
WM_SETTEXT, 0, (LPARAM)OutBuffer);
|
||||
GetDateFormatW(pGlobalData->lcid, DATE_LONGDATE, NULL, NULL, OutBuffer,
|
||||
MAX_SAMPLES_STR_SIZE);
|
||||
SendDlgItemMessageW(hwndDlg, IDC_LONGDATESAMPLE_EDIT,
|
||||
WM_SETTEXT, 0, (LPARAM)OutBuffer);
|
||||
}
|
||||
|
||||
/* Property page dialog callback */
|
||||
|
@ -553,11 +553,11 @@ DatePageProc(HWND hwndDlg,
|
|||
pGlobalData = (PGLOBALDATA)((LPPROPSHEETPAGE)lParam)->lParam;
|
||||
SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pGlobalData);
|
||||
|
||||
InitMinMaxDateSpin(hwndDlg, pGlobalData->lcid);
|
||||
UpdateDateLocaleSamples(hwndDlg, pGlobalData->lcid);
|
||||
InitShortDateCB(hwndDlg, pGlobalData->lcid);
|
||||
InitLongDateCB(hwndDlg, pGlobalData->lcid);
|
||||
InitShortDateSepSamples(hwndDlg, pGlobalData->lcid);
|
||||
InitMinMaxDateSpin(hwndDlg, pGlobalData);
|
||||
UpdateDateLocaleSamples(hwndDlg, pGlobalData);
|
||||
InitShortDateCB(hwndDlg, pGlobalData);
|
||||
InitLongDateCB(hwndDlg, pGlobalData);
|
||||
InitShortDateSepSamples(hwndDlg, pGlobalData);
|
||||
/* TODO: Add other calendar types */
|
||||
break;
|
||||
|
||||
|
@ -602,13 +602,13 @@ DatePageProc(HWND hwndDlg,
|
|||
if (lpnm->code == (UINT)PSN_APPLY)
|
||||
{
|
||||
SetMaxDate(hwndDlg, pGlobalData->lcid);
|
||||
if(!SetShortDateSep(hwndDlg, pGlobalData->lcid)) break;
|
||||
if(!SetShortDateFormat(hwndDlg, pGlobalData->lcid)) break;
|
||||
if(!SetLongDateFormat(hwndDlg, pGlobalData->lcid)) break;
|
||||
InitShortDateCB(hwndDlg, pGlobalData->lcid);
|
||||
if(!SetShortDateSep(hwndDlg, pGlobalData)) break;
|
||||
if(!SetShortDateFormat(hwndDlg, pGlobalData)) break;
|
||||
if(!SetLongDateFormat(hwndDlg, pGlobalData)) break;
|
||||
InitShortDateCB(hwndDlg, pGlobalData);
|
||||
/* FIXME: */
|
||||
//Sleep(15);
|
||||
UpdateDateLocaleSamples(hwndDlg, pGlobalData->lcid);
|
||||
UpdateDateLocaleSamples(hwndDlg, pGlobalData);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
#include <debug.h>
|
||||
|
||||
#define SAMPLE_NUMBER _T("123456789")
|
||||
#define SAMPLE_NUMBER L"123456789"
|
||||
#define NO_FLAG 0
|
||||
|
||||
typedef struct
|
||||
|
@ -87,11 +87,11 @@ static BOOL CALLBACK
|
|||
LocalesEnumProc(LPTSTR lpLocale)
|
||||
{
|
||||
LCID lcid;
|
||||
TCHAR lang[255];
|
||||
WCHAR lang[255];
|
||||
INT index;
|
||||
BOOL bNoShow = FALSE;
|
||||
|
||||
lcid = _tcstoul(lpLocale, NULL, 16);
|
||||
lcid = wcstoul(lpLocale, NULL, 16);
|
||||
|
||||
/* Display only languages with installed support */
|
||||
if (!IsValidLocale(lcid, LCID_INSTALLED))
|
||||
|
@ -102,7 +102,7 @@ LocalesEnumProc(LPTSTR lpLocale)
|
|||
{
|
||||
if (bSpain == FALSE)
|
||||
{
|
||||
LoadString(hApplet, IDS_SPAIN, lang, 255);
|
||||
LoadStringW(hApplet, IDS_SPAIN, lang, 255);
|
||||
bSpain = TRUE;
|
||||
}
|
||||
else
|
||||
|
@ -112,20 +112,20 @@ LocalesEnumProc(LPTSTR lpLocale)
|
|||
}
|
||||
else
|
||||
{
|
||||
GetLocaleInfo(lcid, LOCALE_SLANGUAGE, lang, sizeof(lang)/sizeof(TCHAR));
|
||||
GetLocaleInfoW(lcid, LOCALE_SLANGUAGE, lang, sizeof(lang)/sizeof(WCHAR));
|
||||
}
|
||||
|
||||
if (bNoShow == FALSE)
|
||||
{
|
||||
index = SendMessage(hList,
|
||||
CB_ADDSTRING,
|
||||
0,
|
||||
(LPARAM)lang);
|
||||
index = SendMessageW(hList,
|
||||
CB_ADDSTRING,
|
||||
0,
|
||||
(LPARAM)lang);
|
||||
|
||||
SendMessage(hList,
|
||||
CB_SETITEMDATA,
|
||||
index,
|
||||
(LPARAM)lcid);
|
||||
SendMessageW(hList,
|
||||
CB_SETITEMDATA,
|
||||
index,
|
||||
(LPARAM)lcid);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
@ -196,20 +196,20 @@ UpdateLocaleSample(
|
|||
static VOID
|
||||
CreateLanguagesList(HWND hwnd)
|
||||
{
|
||||
TCHAR langSel[255];
|
||||
WCHAR langSel[255];
|
||||
|
||||
hList = hwnd;
|
||||
bSpain = FALSE;
|
||||
EnumSystemLocales(LocalesEnumProc, LCID_SUPPORTED);
|
||||
EnumSystemLocalesW(LocalesEnumProc, LCID_SUPPORTED);
|
||||
|
||||
/* Select current locale */
|
||||
/* or should it be System and not user? */
|
||||
GetLocaleInfo(GetUserDefaultLCID(), LOCALE_SLANGUAGE, langSel, sizeof(langSel)/sizeof(TCHAR));
|
||||
GetLocaleInfoW(GetUserDefaultLCID(), LOCALE_SLANGUAGE, langSel, sizeof(langSel)/sizeof(WCHAR));
|
||||
|
||||
SendMessage(hList,
|
||||
CB_SELECTSTRING,
|
||||
-1,
|
||||
(LPARAM)langSel);
|
||||
SendMessageW(hList,
|
||||
CB_SELECTSTRING,
|
||||
-1,
|
||||
(LPARAM)langSel);
|
||||
}
|
||||
|
||||
|
||||
|
@ -428,21 +428,21 @@ BOOL
|
|||
CALLBACK
|
||||
LocationsEnumProc(GEOID gId)
|
||||
{
|
||||
TCHAR loc[MAX_STR_SIZE];
|
||||
WCHAR loc[MAX_STR_SIZE];
|
||||
INT index;
|
||||
|
||||
if (GetGeoInfo(gId, GEO_FRIENDLYNAME, loc, MAX_STR_SIZE, LANG_SYSTEM_DEFAULT) == 0)
|
||||
if (GetGeoInfoW(gId, GEO_FRIENDLYNAME, loc, MAX_STR_SIZE, LANG_SYSTEM_DEFAULT) == 0)
|
||||
return TRUE;
|
||||
|
||||
index = (INT)SendMessage(hGeoList,
|
||||
CB_ADDSTRING,
|
||||
0,
|
||||
(LPARAM)loc);
|
||||
index = (INT)SendMessageW(hGeoList,
|
||||
CB_ADDSTRING,
|
||||
0,
|
||||
(LPARAM)loc);
|
||||
|
||||
SendMessage(hGeoList,
|
||||
CB_SETITEMDATA,
|
||||
index,
|
||||
(LPARAM)gId);
|
||||
SendMessageW(hGeoList,
|
||||
CB_SETITEMDATA,
|
||||
index,
|
||||
(LPARAM)gId);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -453,7 +453,7 @@ GEOID
|
|||
CreateLocationsList(HWND hWnd)
|
||||
{
|
||||
GEOID userGeoID;
|
||||
TCHAR loc[MAX_STR_SIZE];
|
||||
WCHAR loc[MAX_STR_SIZE];
|
||||
|
||||
hGeoList = hWnd;
|
||||
|
||||
|
@ -461,16 +461,16 @@ CreateLocationsList(HWND hWnd)
|
|||
|
||||
/* Select current location */
|
||||
userGeoID = GetUserGeoID(GEOCLASS_NATION);
|
||||
GetGeoInfo(userGeoID,
|
||||
GEO_FRIENDLYNAME,
|
||||
loc,
|
||||
MAX_STR_SIZE,
|
||||
LANG_SYSTEM_DEFAULT);
|
||||
GetGeoInfoW(userGeoID,
|
||||
GEO_FRIENDLYNAME,
|
||||
loc,
|
||||
MAX_STR_SIZE,
|
||||
LANG_SYSTEM_DEFAULT);
|
||||
|
||||
SendMessage(hGeoList,
|
||||
CB_SELECTSTRING,
|
||||
(WPARAM) -1,
|
||||
(LPARAM)loc);
|
||||
SendMessageW(hGeoList,
|
||||
CB_SELECTSTRING,
|
||||
(WPARAM) -1,
|
||||
(LPARAM)loc);
|
||||
|
||||
return userGeoID;
|
||||
}
|
||||
|
|
|
@ -91,26 +91,26 @@ InitPropSheetPage(PROPSHEETPAGE *psp, WORD idDlg, DLGPROC DlgProc, LPARAM lParam
|
|||
BOOL
|
||||
OpenSetupInf(VOID)
|
||||
{
|
||||
LPTSTR lpCmdLine;
|
||||
LPTSTR lpSwitch;
|
||||
PWSTR lpCmdLine;
|
||||
PWSTR lpSwitch;
|
||||
size_t len;
|
||||
|
||||
lpCmdLine = GetCommandLine();
|
||||
lpCmdLine = GetCommandLineW();
|
||||
|
||||
lpSwitch = _tcsstr(lpCmdLine, _T("/f:\""));
|
||||
lpSwitch = wcsstr(lpCmdLine, L"/f:\"");
|
||||
if (!lpSwitch)
|
||||
return FALSE;
|
||||
|
||||
len = _tcslen(lpSwitch);
|
||||
if (len < 5 || lpSwitch[len-1] != _T('\"'))
|
||||
len = wcslen(lpSwitch);
|
||||
if (len < 5 || lpSwitch[len-1] != L'\"')
|
||||
{
|
||||
DPRINT1("Invalid switch: %ls\n", lpSwitch);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
lpSwitch[len-1] = _T('\0');
|
||||
lpSwitch[len-1] = L'\0';
|
||||
|
||||
hSetupInf = SetupOpenInfFile(&lpSwitch[4], NULL, INF_STYLE_OLDNT, NULL);
|
||||
hSetupInf = SetupOpenInfFileW(&lpSwitch[4], NULL, INF_STYLE_OLDNT, NULL);
|
||||
if (hSetupInf == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
DPRINT1("Failed to open INF file: %ls\n", &lpSwitch[4]);
|
||||
|
@ -124,27 +124,27 @@ VOID
|
|||
ParseSetupInf(VOID)
|
||||
{
|
||||
INFCONTEXT InfContext;
|
||||
TCHAR szBuffer[30];
|
||||
WCHAR szBuffer[30];
|
||||
|
||||
if (!SetupFindFirstLine(hSetupInf,
|
||||
_T("Unattend"),
|
||||
_T("LocaleID"),
|
||||
&InfContext))
|
||||
if (!SetupFindFirstLineW(hSetupInf,
|
||||
L"Unattend",
|
||||
L"LocaleID",
|
||||
&InfContext))
|
||||
{
|
||||
SetupCloseInfFile(hSetupInf);
|
||||
DPRINT1("SetupFindFirstLine failed\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!SetupGetStringField(&InfContext, 1, szBuffer,
|
||||
sizeof(szBuffer) / sizeof(TCHAR), NULL))
|
||||
if (!SetupGetStringFieldW(&InfContext, 1, szBuffer,
|
||||
sizeof(szBuffer) / sizeof(WCHAR), NULL))
|
||||
{
|
||||
SetupCloseInfFile(hSetupInf);
|
||||
DPRINT1("SetupGetStringField failed\n");
|
||||
return;
|
||||
}
|
||||
|
||||
UnattendLCID = _tcstoul(szBuffer, NULL, 16);
|
||||
UnattendLCID = wcstoul(szBuffer, NULL, 16);
|
||||
IsUnattendedSetupEnabled = 1;
|
||||
SetupCloseInfFile(hSetupInf);
|
||||
}
|
||||
|
@ -169,7 +169,7 @@ Applet(HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM lParam)
|
|||
|
||||
ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
|
||||
psh.dwSize = sizeof(PROPSHEETHEADER);
|
||||
psh.dwFlags = PSH_PROPSHEETPAGE | PSH_PROPTITLE;
|
||||
psh.dwFlags = PSH_PROPSHEETPAGE;
|
||||
psh.hwndParent = hCPLWindow;
|
||||
psh.hInstance = hApplet;
|
||||
psh.hIcon = LoadIcon(hApplet, MAKEINTRESOURCE(IDC_CPLICON));
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
#include <winuser.h>
|
||||
#include <cpl.h>
|
||||
#include <setupapi.h>
|
||||
#include <tchar.h>
|
||||
#include <malloc.h>
|
||||
#include <ndk/exfuncs.h>
|
||||
|
||||
|
@ -121,11 +120,11 @@ INT_PTR CALLBACK
|
|||
SortPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
/* misc.c */
|
||||
LPTSTR
|
||||
InsSpacesFmt(LPCTSTR szSourceStr, LPCTSTR szFmtStr);
|
||||
PWSTR
|
||||
InsSpacesFmt(PCWSTR szSourceStr, PCWSTR szFmtStr);
|
||||
|
||||
LPTSTR
|
||||
ReplaceSubStr(LPCTSTR szSourceStr, LPCTSTR szStrToReplace, LPCTSTR szTempl);
|
||||
PWSTR
|
||||
ReplaceSubStr(PCWSTR szSourceStr, PCWSTR szStrToReplace, PCWSTR szTempl);
|
||||
|
||||
LONG
|
||||
APIENTRY
|
||||
|
|
|
@ -16,47 +16,47 @@
|
|||
|
||||
/* szLayoutID like 00000409, szLangID like 00000409 */
|
||||
static BOOL
|
||||
IsLayoutExists(LPTSTR szLayoutID, LPTSTR szLangID)
|
||||
IsLayoutExists(PWSTR szLayoutID, PWSTR szLangID)
|
||||
{
|
||||
HKEY hKey, hSubKey;
|
||||
TCHAR szPreload[CCH_LAYOUT_ID + 1], szLayoutNum[3 + 1],
|
||||
WCHAR szPreload[CCH_LAYOUT_ID + 1], szLayoutNum[3 + 1],
|
||||
szTmp[CCH_LAYOUT_ID + 1], szOldLangID[CCH_LAYOUT_ID + 1];
|
||||
DWORD dwIndex = 0, dwType, dwSize;
|
||||
BOOL IsLangExists = FALSE;
|
||||
LANGID langid;
|
||||
|
||||
if (RegOpenKeyEx(HKEY_CURRENT_USER, _T("Keyboard Layout\\Preload"),
|
||||
if (RegOpenKeyExW(HKEY_CURRENT_USER, L"Keyboard Layout\\Preload",
|
||||
0, KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS)
|
||||
{
|
||||
dwSize = sizeof(szLayoutNum);
|
||||
|
||||
while (RegEnumValue(hKey, dwIndex, szLayoutNum, &dwSize, NULL, &dwType, NULL, NULL) == ERROR_SUCCESS)
|
||||
while (RegEnumValueW(hKey, dwIndex, szLayoutNum, &dwSize, NULL, &dwType, NULL, NULL) == ERROR_SUCCESS)
|
||||
{
|
||||
dwSize = sizeof(szPreload);
|
||||
if (RegQueryValueEx(hKey, szLayoutNum, NULL, NULL, (LPBYTE)szPreload, &dwSize) != ERROR_SUCCESS)
|
||||
if (RegQueryValueExW(hKey, szLayoutNum, NULL, NULL, (LPBYTE)szPreload, &dwSize) != ERROR_SUCCESS)
|
||||
{
|
||||
RegCloseKey(hKey);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
langid = (LANGID)_tcstoul(szPreload, NULL, 16);
|
||||
GetLocaleInfo(langid, LOCALE_ILANGUAGE, szTmp, sizeof(szTmp) / sizeof(TCHAR));
|
||||
wsprintf(szOldLangID, _T("0000%s"), szTmp);
|
||||
langid = (LANGID)wcstoul(szPreload, NULL, 16);
|
||||
GetLocaleInfoW(langid, LOCALE_ILANGUAGE, szTmp, sizeof(szTmp) / sizeof(WCHAR));
|
||||
wsprintf(szOldLangID, L"0000%s", szTmp);
|
||||
|
||||
if (_tcscmp(szOldLangID, szLangID) == 0)
|
||||
if (wcscmp(szOldLangID, szLangID) == 0)
|
||||
IsLangExists = TRUE;
|
||||
else
|
||||
IsLangExists = FALSE;
|
||||
|
||||
if (szPreload[0] == 'd')
|
||||
{
|
||||
if (RegOpenKeyEx(HKEY_CURRENT_USER, _T("Keyboard Layout\\Substitutes"),
|
||||
if (RegOpenKeyExW(HKEY_CURRENT_USER, L"Keyboard Layout\\Substitutes",
|
||||
0, KEY_QUERY_VALUE, &hSubKey) == ERROR_SUCCESS)
|
||||
{
|
||||
dwSize = sizeof(szTmp);
|
||||
RegQueryValueEx(hSubKey, szPreload, NULL, NULL, (LPBYTE)szTmp, &dwSize);
|
||||
RegQueryValueExW(hSubKey, szPreload, NULL, NULL, (LPBYTE)szTmp, &dwSize);
|
||||
|
||||
if ((_tcscmp(szTmp, szLayoutID) == 0)&&(IsLangExists))
|
||||
if ((wcscmp(szTmp, szLayoutID) == 0)&&(IsLangExists))
|
||||
{
|
||||
RegCloseKey(hSubKey);
|
||||
RegCloseKey(hKey);
|
||||
|
@ -66,7 +66,7 @@ IsLayoutExists(LPTSTR szLayoutID, LPTSTR szLangID)
|
|||
}
|
||||
else
|
||||
{
|
||||
if ((_tcscmp(szPreload, szLayoutID) == 0) && (IsLangExists))
|
||||
if ((wcscmp(szPreload, szLayoutID) == 0) && (IsLangExists))
|
||||
{
|
||||
RegCloseKey(hKey);
|
||||
return TRUE;
|
||||
|
@ -85,14 +85,14 @@ IsLayoutExists(LPTSTR szLayoutID, LPTSTR szLangID)
|
|||
}
|
||||
|
||||
static INT
|
||||
GetLayoutCount(LPTSTR szLang)
|
||||
GetLayoutCount(PWSTR szLang)
|
||||
{
|
||||
HKEY hKey;
|
||||
TCHAR szLayoutID[3 + 1], szPreload[CCH_LAYOUT_ID + 1], szLOLang[MAX_PATH];
|
||||
WCHAR szLayoutID[3 + 1], szPreload[CCH_LAYOUT_ID + 1], szLOLang[MAX_PATH];
|
||||
DWORD dwIndex = 0, dwType, dwSize;
|
||||
UINT Count = 0, i, j;
|
||||
|
||||
if (RegOpenKeyEx(HKEY_CURRENT_USER, _T("Keyboard Layout\\Preload"),
|
||||
if (RegOpenKeyExW(HKEY_CURRENT_USER, L"Keyboard Layout\\Preload",
|
||||
0, KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS)
|
||||
{
|
||||
dwSize = sizeof(szLayoutID);
|
||||
|
@ -100,12 +100,12 @@ GetLayoutCount(LPTSTR szLang)
|
|||
while (RegEnumValue(hKey, dwIndex, szLayoutID, &dwSize, NULL, &dwType, NULL, NULL) == ERROR_SUCCESS)
|
||||
{
|
||||
dwSize = sizeof(szPreload);
|
||||
RegQueryValueEx(hKey, szLayoutID, NULL, NULL, (LPBYTE)szPreload, &dwSize);
|
||||
RegQueryValueExW(hKey, szLayoutID, NULL, NULL, (LPBYTE)szPreload, &dwSize);
|
||||
|
||||
for (i = 4, j = 0; i < _tcslen(szPreload)+1; i++, j++)
|
||||
for (i = 4, j = 0; i < wcslen(szPreload)+1; i++, j++)
|
||||
szLOLang[j] = szPreload[i];
|
||||
|
||||
if (_tcscmp(szLOLang, szLang) == 0) Count += 1;
|
||||
if (wcscmp(szLOLang, szLang) == 0) Count += 1;
|
||||
|
||||
dwSize = sizeof(szLayoutID);
|
||||
dwIndex++;
|
||||
|
@ -119,24 +119,24 @@ GetLayoutCount(LPTSTR szLang)
|
|||
|
||||
/* szLayoutID like 00000409, szLangID like 00000409 */
|
||||
static BOOL
|
||||
AddNewLayout(LPTSTR szLayoutID, LPTSTR szLangID)
|
||||
AddNewLayout(PWSTR szLayoutID, PWSTR szLangID)
|
||||
{
|
||||
TCHAR NewLayout[CCH_ULONG_DEC + 1], Lang[MAX_PATH],
|
||||
WCHAR NewLayout[CCH_ULONG_DEC + 1], Lang[MAX_PATH],
|
||||
LangID[CCH_LAYOUT_ID + 1], SubPath[CCH_LAYOUT_ID + 1];
|
||||
HKEY hKey, hSubKey;
|
||||
DWORD cValues;
|
||||
LCID lcid;
|
||||
|
||||
if (RegOpenKeyEx(HKEY_CURRENT_USER, _T("Keyboard Layout\\Preload"), 0, KEY_ALL_ACCESS, &hKey) == ERROR_SUCCESS)
|
||||
if (RegOpenKeyExW(HKEY_CURRENT_USER, L"Keyboard Layout\\Preload", 0, KEY_ALL_ACCESS, &hKey) == ERROR_SUCCESS)
|
||||
{
|
||||
if (RegQueryInfoKey(hKey, NULL, NULL, NULL, NULL, NULL, NULL, &cValues, NULL, NULL, NULL, NULL) == ERROR_SUCCESS)
|
||||
{
|
||||
_ultot(cValues + 1, NewLayout, 10);
|
||||
_ultow(cValues + 1, NewLayout, 10);
|
||||
|
||||
lcid = _tcstoul(szLangID, NULL, 16);
|
||||
lcid = wcstoul(szLangID, NULL, 16);
|
||||
|
||||
GetLocaleInfo(MAKELCID(lcid, SORT_DEFAULT), LOCALE_ILANGUAGE, Lang, sizeof(Lang) / sizeof(TCHAR));
|
||||
wsprintf(LangID, _T("0000%s"), Lang);
|
||||
GetLocaleInfoW(MAKELCID(lcid, SORT_DEFAULT), LOCALE_ILANGUAGE, Lang, sizeof(Lang) / sizeof(WCHAR));
|
||||
wsprintf(LangID, L"0000%s", Lang);
|
||||
|
||||
if (IsLayoutExists(szLayoutID, LangID))
|
||||
{
|
||||
|
@ -146,22 +146,22 @@ AddNewLayout(LPTSTR szLayoutID, LPTSTR szLangID)
|
|||
|
||||
if (GetLayoutCount(Lang) >= 1)
|
||||
{
|
||||
wsprintf(SubPath, _T("d%03d%s"), GetLayoutCount(Lang), Lang);
|
||||
wsprintf(SubPath, L"d%03d%s", GetLayoutCount(Lang), Lang);
|
||||
}
|
||||
else if ((_tcscmp(LangID, szLayoutID) != 0) && (GetLayoutCount(Lang) == 0))
|
||||
else if ((wcscmp(LangID, szLayoutID) != 0) && (GetLayoutCount(Lang) == 0))
|
||||
{
|
||||
wsprintf(SubPath, _T("d%03d%s"), 0, Lang);
|
||||
wsprintf(SubPath, L"d%03d%s", 0, Lang);
|
||||
}
|
||||
else SubPath[0] = '\0';
|
||||
else SubPath[0] = L'\0';
|
||||
|
||||
if (_tcslen(SubPath) != 0)
|
||||
if (wcslen(SubPath) != 0)
|
||||
{
|
||||
if (RegCreateKeyEx(HKEY_CURRENT_USER, _T("Keyboard Layout\\Substitutes"), 0, NULL,
|
||||
REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS,
|
||||
NULL, &hSubKey, NULL) == ERROR_SUCCESS)
|
||||
if (RegCreateKeyExW(HKEY_CURRENT_USER, L"Keyboard Layout\\Substitutes", 0, NULL,
|
||||
REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS,
|
||||
NULL, &hSubKey, NULL) == ERROR_SUCCESS)
|
||||
{
|
||||
if (RegSetValueEx(hSubKey, SubPath, 0, REG_SZ, (LPBYTE)szLayoutID,
|
||||
(DWORD)((CCH_LAYOUT_ID + 1) * sizeof(TCHAR))) != ERROR_SUCCESS)
|
||||
if (RegSetValueExW(hSubKey, SubPath, 0, REG_SZ, (LPBYTE)szLayoutID,
|
||||
(DWORD)((CCH_LAYOUT_ID + 1) * sizeof(WCHAR))) != ERROR_SUCCESS)
|
||||
{
|
||||
RegCloseKey(hSubKey);
|
||||
RegCloseKey(hKey);
|
||||
|
@ -172,12 +172,12 @@ AddNewLayout(LPTSTR szLayoutID, LPTSTR szLangID)
|
|||
lstrcpy(szLayoutID, SubPath);
|
||||
}
|
||||
|
||||
RegSetValueEx(hKey,
|
||||
NewLayout,
|
||||
0,
|
||||
REG_SZ,
|
||||
(LPBYTE)szLayoutID,
|
||||
(DWORD)((CCH_LAYOUT_ID + 1) * sizeof(TCHAR)));
|
||||
RegSetValueExW(hKey,
|
||||
NewLayout,
|
||||
0,
|
||||
REG_SZ,
|
||||
(LPBYTE)szLayoutID,
|
||||
(DWORD)((CCH_LAYOUT_ID + 1) * sizeof(WCHAR)));
|
||||
}
|
||||
RegCloseKey(hKey);
|
||||
}
|
||||
|
@ -189,16 +189,16 @@ VOID
|
|||
AddNewKbLayoutsByLcid(LCID Lcid)
|
||||
{
|
||||
HINF hIntlInf;
|
||||
TCHAR szLang[CCH_LAYOUT_ID + 1], szLangID[CCH_LAYOUT_ID + 1];
|
||||
TCHAR szLangStr[MAX_STR_SIZE], szLayoutStr[MAX_STR_SIZE], szStr[MAX_STR_SIZE];
|
||||
WCHAR szLang[CCH_LAYOUT_ID + 1], szLangID[CCH_LAYOUT_ID + 1];
|
||||
WCHAR szLangStr[MAX_STR_SIZE], szLayoutStr[MAX_STR_SIZE], szStr[MAX_STR_SIZE];
|
||||
INFCONTEXT InfContext;
|
||||
LONG Count;
|
||||
DWORD FieldCount, Index;
|
||||
|
||||
GetLocaleInfo(MAKELCID(Lcid, SORT_DEFAULT), LOCALE_ILANGUAGE, szLang, sizeof(szLang) / sizeof(TCHAR));
|
||||
wsprintf(szLangID, _T("0000%s"), szLang);
|
||||
GetLocaleInfoW(MAKELCID(Lcid, SORT_DEFAULT), LOCALE_ILANGUAGE, szLang, sizeof(szLang) / sizeof(WCHAR));
|
||||
wsprintf(szLangID, L"0000%s", szLang);
|
||||
|
||||
hIntlInf = SetupOpenInfFile(_T("intl.inf"), NULL, INF_STYLE_WIN4, NULL);
|
||||
hIntlInf = SetupOpenInfFileW(L"intl.inf", NULL, INF_STYLE_WIN4, NULL);
|
||||
|
||||
if (hIntlInf == INVALID_HANDLE_VALUE)
|
||||
return;
|
||||
|
@ -210,10 +210,10 @@ AddNewKbLayoutsByLcid(LCID Lcid)
|
|||
return;
|
||||
}
|
||||
|
||||
Count = SetupGetLineCount(hIntlInf, _T("Locales"));
|
||||
Count = SetupGetLineCount(hIntlInf, L"Locales");
|
||||
if (Count <= 0) return;
|
||||
|
||||
if (SetupFindFirstLine(hIntlInf, _T("Locales"), szLangID, &InfContext))
|
||||
if (SetupFindFirstLine(hIntlInf, L"Locales", szLangID, &InfContext))
|
||||
{
|
||||
FieldCount = SetupGetFieldCount(&InfContext);
|
||||
|
||||
|
@ -225,12 +225,12 @@ AddNewKbLayoutsByLcid(LCID Lcid)
|
|||
{
|
||||
INT i, j;
|
||||
|
||||
if (_tcslen(szStr) != 13) continue;
|
||||
if (wcslen(szStr) != 13) continue;
|
||||
|
||||
wsprintf(szLangStr, _T("0000%s"), szStr);
|
||||
szLangStr[8] = '\0';
|
||||
wsprintf(szLangStr, L"0000%s", szStr);
|
||||
szLangStr[8] = L'\0';
|
||||
|
||||
for (i = 5, j = 0; i <= _tcslen(szStr); i++, j++)
|
||||
for (i = 5, j = 0; i <= wcslen(szStr); i++, j++)
|
||||
szLayoutStr[j] = szStr[i];
|
||||
|
||||
AddNewLayout(szLayoutStr, szLangStr);
|
||||
|
|
|
@ -9,7 +9,7 @@ LanguagesPageProc(HWND hwndDlg,
|
|||
WPARAM wParam,
|
||||
LPARAM lParam)
|
||||
{
|
||||
SHELLEXECUTEINFO shInputDll;
|
||||
SHELLEXECUTEINFOW shInputDll;
|
||||
|
||||
switch (uMsg)
|
||||
{
|
||||
|
@ -23,13 +23,13 @@ LanguagesPageProc(HWND hwndDlg,
|
|||
case IDC_DETAIL_BUTTON:
|
||||
if (HIWORD(wParam) == BN_CLICKED)
|
||||
{
|
||||
memset(&shInputDll, 0x0, sizeof(SHELLEXECUTEINFO));
|
||||
memset(&shInputDll, 0x0, sizeof(SHELLEXECUTEINFOW));
|
||||
shInputDll.cbSize = sizeof(shInputDll);
|
||||
shInputDll.hwnd = hwndDlg;
|
||||
shInputDll.lpVerb = _T("open");
|
||||
shInputDll.lpFile = _T("RunDll32.exe");
|
||||
shInputDll.lpParameters = _T("shell32.dll,Control_RunDLL input.dll");
|
||||
if (ShellExecuteEx(&shInputDll) == 0)
|
||||
shInputDll.lpVerb = L"open";
|
||||
shInputDll.lpFile = L"RunDll32.exe";
|
||||
shInputDll.lpParameters = L"shell32.dll,Control_RunDLL input.dll";
|
||||
if (ShellExecuteExW(&shInputDll) == 0)
|
||||
{
|
||||
PrintErrorMsgBox(IDS_ERROR_INPUT_DLL);
|
||||
}
|
||||
|
|
|
@ -3,25 +3,25 @@
|
|||
#define NUM_SHEETS 4
|
||||
|
||||
/* Insert the space */
|
||||
LPTSTR
|
||||
InsSpacePos(LPCTSTR szInsStr, const int nPos)
|
||||
PWSTR
|
||||
InsSpacePos(PCWSTR szInsStr, const int nPos)
|
||||
{
|
||||
LPTSTR pszDestStr;
|
||||
PWSTR pszDestStr;
|
||||
INT nDestStrCnt = 0;
|
||||
INT nStrCnt;
|
||||
INT nStrSize;
|
||||
|
||||
pszDestStr = (LPTSTR)malloc(MAX_SAMPLES_STR_SIZE * sizeof(TCHAR));
|
||||
pszDestStr = (PWSTR)malloc(MAX_SAMPLES_STR_SIZE * sizeof(WCHAR));
|
||||
|
||||
_tcscpy(pszDestStr, szInsStr);
|
||||
wcscpy(pszDestStr, szInsStr);
|
||||
|
||||
nStrSize = _tcslen(szInsStr);
|
||||
nStrSize = wcslen(szInsStr);
|
||||
|
||||
for (nStrCnt = 0; nStrCnt < nStrSize; nStrCnt++)
|
||||
{
|
||||
if (nStrCnt == nStrSize - nPos)
|
||||
{
|
||||
pszDestStr[nDestStrCnt] = _T(' ');
|
||||
pszDestStr[nDestStrCnt] = L' ';
|
||||
nDestStrCnt++;
|
||||
}
|
||||
|
||||
|
@ -29,38 +29,38 @@ InsSpacePos(LPCTSTR szInsStr, const int nPos)
|
|||
nDestStrCnt++;
|
||||
}
|
||||
|
||||
pszDestStr[nDestStrCnt] = _T('\0');
|
||||
pszDestStr[nDestStrCnt] = L'\0';
|
||||
|
||||
return pszDestStr;
|
||||
}
|
||||
|
||||
/* Insert the spaces by format string separated by ';' */
|
||||
LPTSTR
|
||||
InsSpacesFmt(LPCTSTR szSourceStr, LPCTSTR szFmtStr)
|
||||
PWSTR
|
||||
InsSpacesFmt(PCWSTR szSourceStr, PCWSTR szFmtStr)
|
||||
{
|
||||
LPTSTR pszDestStr;
|
||||
LPTSTR pszTempStr;
|
||||
TCHAR szFmtVal[255];
|
||||
PWSTR pszDestStr;
|
||||
PWSTR pszTempStr;
|
||||
WCHAR szFmtVal[255];
|
||||
UINT nFmtCount = 0;
|
||||
INT nValCount = 0;
|
||||
INT nLastVal = 0;
|
||||
INT nSpaceOffset = 0;
|
||||
BOOL wasNul=FALSE;
|
||||
|
||||
pszDestStr = (LPTSTR)malloc(255 * sizeof(TCHAR));
|
||||
pszDestStr = (PWSTR)malloc(255 * sizeof(WCHAR));
|
||||
|
||||
_tcscpy(pszDestStr, szSourceStr);
|
||||
wcscpy(pszDestStr, szSourceStr);
|
||||
|
||||
/* If format is clean return source string */
|
||||
if (!*szFmtStr)
|
||||
return pszDestStr;
|
||||
|
||||
/* Search for all format values */
|
||||
for (nFmtCount = 0; nFmtCount <= _tcslen(szFmtStr); nFmtCount++)
|
||||
for (nFmtCount = 0; nFmtCount <= wcslen(szFmtStr); nFmtCount++)
|
||||
{
|
||||
if (szFmtStr[nFmtCount] == _T(';') || szFmtStr[nFmtCount] == _T('\0'))
|
||||
if (szFmtStr[nFmtCount] == L';' || szFmtStr[nFmtCount] == L'\0')
|
||||
{
|
||||
if (_ttoi(szFmtVal) == 0 && !wasNul)
|
||||
if (_wtoi(szFmtVal) == 0 && !wasNul)
|
||||
{
|
||||
wasNul=TRUE;
|
||||
break;
|
||||
|
@ -73,22 +73,22 @@ InsSpacesFmt(LPCTSTR szSourceStr, LPCTSTR szFmtStr)
|
|||
}
|
||||
else
|
||||
{
|
||||
nSpaceOffset += _ttoi(szFmtVal);
|
||||
nSpaceOffset += _wtoi(szFmtVal);
|
||||
}
|
||||
|
||||
szFmtVal[nValCount] = _T('\0');
|
||||
szFmtVal[nValCount] = L'\0';
|
||||
nValCount=0;
|
||||
|
||||
/* Insert space to finded position plus all pos before */
|
||||
pszTempStr = InsSpacePos(pszDestStr, nSpaceOffset);
|
||||
_tcscpy(pszDestStr,pszTempStr);
|
||||
wcscpy(pszDestStr,pszTempStr);
|
||||
free(pszTempStr);
|
||||
|
||||
/* Num of spaces total increment */
|
||||
if (!wasNul)
|
||||
{
|
||||
nSpaceOffset++;
|
||||
nLastVal = _ttoi(szFmtVal);
|
||||
nLastVal = _wtoi(szFmtVal);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -100,10 +100,10 @@ InsSpacesFmt(LPCTSTR szSourceStr, LPCTSTR szFmtStr)
|
|||
/* Create spaces for rest part of string */
|
||||
if (wasNul && nLastVal != 0)
|
||||
{
|
||||
for (nFmtCount = nSpaceOffset + nLastVal; nFmtCount < _tcslen(pszDestStr); nFmtCount += nLastVal + 1)
|
||||
for (nFmtCount = nSpaceOffset + nLastVal; nFmtCount < wcslen(pszDestStr); nFmtCount += nLastVal + 1)
|
||||
{
|
||||
pszTempStr = InsSpacePos(pszDestStr, nFmtCount);
|
||||
_tcscpy(pszDestStr, pszTempStr);
|
||||
wcscpy(pszDestStr, pszTempStr);
|
||||
free(pszTempStr);
|
||||
}
|
||||
}
|
||||
|
@ -112,30 +112,30 @@ InsSpacesFmt(LPCTSTR szSourceStr, LPCTSTR szFmtStr)
|
|||
}
|
||||
|
||||
/* Replace given template in source string with string to replace and return received string */
|
||||
LPTSTR
|
||||
ReplaceSubStr(LPCTSTR szSourceStr,
|
||||
LPCTSTR szStrToReplace,
|
||||
LPCTSTR szTempl)
|
||||
PWSTR
|
||||
ReplaceSubStr(PCWSTR szSourceStr,
|
||||
PCWSTR szStrToReplace,
|
||||
PCWSTR szTempl)
|
||||
{
|
||||
LPTSTR szDestStr;
|
||||
PWSTR szDestStr;
|
||||
UINT nCharCnt;
|
||||
UINT nSubStrCnt;
|
||||
UINT nDestStrCnt;
|
||||
UINT nFirstCharCnt;
|
||||
|
||||
szDestStr = (LPTSTR)malloc(MAX_SAMPLES_STR_SIZE * sizeof(TCHAR));
|
||||
szDestStr = (PWSTR)malloc(MAX_SAMPLES_STR_SIZE * sizeof(WCHAR));
|
||||
|
||||
nDestStrCnt = 0;
|
||||
nFirstCharCnt = 0;
|
||||
|
||||
_tcscpy(szDestStr, _T(""));
|
||||
wcscpy(szDestStr, L"");
|
||||
|
||||
while (nFirstCharCnt < _tcslen(szSourceStr))
|
||||
while (nFirstCharCnt < wcslen(szSourceStr))
|
||||
{
|
||||
if (szSourceStr[nFirstCharCnt] == szTempl[0])
|
||||
{
|
||||
nSubStrCnt = 0;
|
||||
for (nCharCnt = nFirstCharCnt; nCharCnt < nFirstCharCnt + _tcslen(szTempl); nCharCnt++)
|
||||
for (nCharCnt = nFirstCharCnt; nCharCnt < nFirstCharCnt + wcslen(szTempl); nCharCnt++)
|
||||
{
|
||||
if (szSourceStr[nCharCnt] == szTempl[nSubStrCnt])
|
||||
{
|
||||
|
@ -146,11 +146,11 @@ ReplaceSubStr(LPCTSTR szSourceStr,
|
|||
break;
|
||||
}
|
||||
|
||||
if (_tcslen(szTempl) == nSubStrCnt)
|
||||
if (wcslen(szTempl) == nSubStrCnt)
|
||||
{
|
||||
_tcscat(szDestStr, szStrToReplace);
|
||||
nDestStrCnt = _tcslen(szDestStr);
|
||||
nFirstCharCnt += _tcslen(szTempl) - 1;
|
||||
wcscat(szDestStr, szStrToReplace);
|
||||
nDestStrCnt = wcslen(szDestStr);
|
||||
nFirstCharCnt += wcslen(szTempl) - 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -158,7 +158,7 @@ ReplaceSubStr(LPCTSTR szSourceStr,
|
|||
else
|
||||
{
|
||||
szDestStr[nDestStrCnt++] = szSourceStr[nFirstCharCnt];
|
||||
szDestStr[nDestStrCnt] = _T('\0');
|
||||
szDestStr[nDestStrCnt] = L'\0';
|
||||
}
|
||||
|
||||
nFirstCharCnt++;
|
||||
|
@ -169,10 +169,10 @@ ReplaceSubStr(LPCTSTR szSourceStr,
|
|||
|
||||
|
||||
static VOID
|
||||
InitPropSheetPage(PROPSHEETPAGE *psp, WORD idDlg, DLGPROC DlgProc, PGLOBALDATA pGlobalData)
|
||||
InitPropSheetPage(PROPSHEETPAGEW *psp, WORD idDlg, DLGPROC DlgProc, PGLOBALDATA pGlobalData)
|
||||
{
|
||||
ZeroMemory(psp, sizeof(PROPSHEETPAGE));
|
||||
psp->dwSize = sizeof(PROPSHEETPAGE);
|
||||
ZeroMemory(psp, sizeof(PROPSHEETPAGEW));
|
||||
psp->dwSize = sizeof(PROPSHEETPAGEW);
|
||||
psp->dwFlags = PSP_DEFAULT;
|
||||
psp->hInstance = hApplet;
|
||||
psp->pszTemplate = MAKEINTRESOURCE(idDlg);
|
||||
|
@ -188,16 +188,16 @@ SetupApplet(
|
|||
HWND hwndDlg,
|
||||
PGLOBALDATA pGlobalData)
|
||||
{
|
||||
PROPSHEETPAGE PsPage[NUM_SHEETS + 1];
|
||||
PROPSHEETHEADER psh;
|
||||
TCHAR Caption[MAX_STR_SIZE];
|
||||
INT ret;
|
||||
PROPSHEETPAGEW PsPage[NUM_SHEETS + 1];
|
||||
PROPSHEETHEADERW psh;
|
||||
WCHAR Caption[MAX_STR_SIZE];
|
||||
INT_PTR ret;
|
||||
|
||||
LoadString(hApplet, IDS_CUSTOMIZE_TITLE, Caption, sizeof(Caption) / sizeof(TCHAR));
|
||||
LoadStringW(hApplet, IDS_CUSTOMIZE_TITLE, Caption, sizeof(Caption) / sizeof(TCHAR));
|
||||
|
||||
ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
|
||||
psh.dwSize = sizeof(PROPSHEETHEADER);
|
||||
psh.dwFlags = PSH_PROPSHEETPAGE | PSH_USECALLBACK | PSH_PROPTITLE;
|
||||
psh.dwFlags = PSH_PROPSHEETPAGE | PSH_USECALLBACK;
|
||||
psh.hwndParent = hwndDlg;
|
||||
psh.hInstance = hApplet;
|
||||
psh.hIcon = LoadIcon(hApplet, MAKEINTRESOURCE(IDC_CPLICON));
|
||||
|
@ -217,7 +217,7 @@ SetupApplet(
|
|||
InitPropSheetPage(&PsPage[4], IDD_SORTPAGE, SortPageProc, pGlobalData);
|
||||
}
|
||||
|
||||
ret = PropertySheet(&psh);
|
||||
ret = PropertySheetW(&psh);
|
||||
|
||||
return (LONG)(ret != -1);
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -14,11 +14,11 @@ static HWND hWndSortList = NULL;
|
|||
|
||||
|
||||
static BOOL CALLBACK
|
||||
SortTestEnumProc(LPTSTR lpLocale)
|
||||
SortTestEnumProc(PWSTR lpLocale)
|
||||
{
|
||||
LCID lcid;
|
||||
|
||||
lcid = _tcstoul(lpLocale, NULL, 16);
|
||||
lcid = wcstoul(lpLocale, NULL, 16);
|
||||
|
||||
if ((LANGIDFROMLCID(lcid) == LANGIDFROMLCID(userLcid)) &&
|
||||
(SORTIDFROMLCID(lcid) != SORTIDFROMLCID(userLcid)))
|
||||
|
@ -39,7 +39,7 @@ IsSortPageNeeded(LCID lcid)
|
|||
userLcid = lcid;
|
||||
bSortPage = FALSE;
|
||||
|
||||
EnumSystemLocales(SortTestEnumProc, LCID_ALTERNATE_SORTS);
|
||||
EnumSystemLocalesW(SortTestEnumProc, LCID_ALTERNATE_SORTS);
|
||||
|
||||
return bSortPage;
|
||||
}
|
||||
|
@ -49,25 +49,25 @@ static BOOL CALLBACK
|
|||
SortEnumProc(LPTSTR lpLocale)
|
||||
{
|
||||
LCID lcid;
|
||||
TCHAR lang[255];
|
||||
WCHAR lang[255];
|
||||
INT index;
|
||||
|
||||
lcid = _tcstoul(lpLocale, NULL, 16);
|
||||
lcid = wcstoul(lpLocale, NULL, 16);
|
||||
|
||||
if ((LANGIDFROMLCID(lcid) == LANGIDFROMLCID(userLcid)) &&
|
||||
(SORTIDFROMLCID(lcid) != SORTIDFROMLCID(userLcid)))
|
||||
{
|
||||
GetLocaleInfo(lcid, LOCALE_SSORTNAME, lang, sizeof(lang)/sizeof(TCHAR));
|
||||
GetLocaleInfoW(lcid, LOCALE_SSORTNAME, lang, sizeof(lang)/sizeof(WCHAR));
|
||||
|
||||
index = SendMessage(hWndSortList,
|
||||
CB_ADDSTRING,
|
||||
0,
|
||||
(LPARAM)lang);
|
||||
index = SendMessageW(hWndSortList,
|
||||
CB_ADDSTRING,
|
||||
0,
|
||||
(LPARAM)lang);
|
||||
|
||||
SendMessage(hWndSortList,
|
||||
CB_SETITEMDATA,
|
||||
index,
|
||||
(LPARAM)lcid);
|
||||
SendMessageW(hWndSortList,
|
||||
CB_SETITEMDATA,
|
||||
index,
|
||||
(LPARAM)lcid);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
@ -76,7 +76,7 @@ SortEnumProc(LPTSTR lpLocale)
|
|||
static VOID
|
||||
CreateSortList(HWND hwnd, LCID lcid)
|
||||
{
|
||||
TCHAR lang[255];
|
||||
WCHAR lang[255];
|
||||
INT index;
|
||||
|
||||
hWndSortList = hwnd;
|
||||
|
@ -86,60 +86,60 @@ CreateSortList(HWND hwnd, LCID lcid)
|
|||
lcid == MAKELCID(MAKELANGID(LANG_SPANISH, SUBLANG_SPANISH_MODERN), SORT_DEFAULT))
|
||||
{
|
||||
/* Add traditional sorting */
|
||||
GetLocaleInfo(MAKELANGID(LANG_SPANISH, SUBLANG_SPANISH),
|
||||
LOCALE_SSORTNAME, lang, sizeof(lang)/sizeof(TCHAR));
|
||||
GetLocaleInfoW(MAKELANGID(LANG_SPANISH, SUBLANG_SPANISH),
|
||||
LOCALE_SSORTNAME, lang, sizeof(lang)/sizeof(TCHAR));
|
||||
|
||||
index = SendMessage(hwnd,
|
||||
CB_ADDSTRING,
|
||||
0,
|
||||
(LPARAM)lang);
|
||||
index = SendMessageW(hwnd,
|
||||
CB_ADDSTRING,
|
||||
0,
|
||||
(LPARAM)lang);
|
||||
|
||||
SendMessage(hwnd,
|
||||
CB_SETITEMDATA,
|
||||
index,
|
||||
(LPARAM)MAKELANGID(LANG_SPANISH, SUBLANG_SPANISH));
|
||||
SendMessageW(hwnd,
|
||||
CB_SETITEMDATA,
|
||||
index,
|
||||
(LPARAM)MAKELANGID(LANG_SPANISH, SUBLANG_SPANISH));
|
||||
|
||||
/* Add modern sorting */
|
||||
GetLocaleInfo(MAKELANGID(LANG_SPANISH, SUBLANG_SPANISH_MODERN),
|
||||
LOCALE_SSORTNAME, lang, sizeof(lang)/sizeof(TCHAR));
|
||||
GetLocaleInfoW(MAKELANGID(LANG_SPANISH, SUBLANG_SPANISH_MODERN),
|
||||
LOCALE_SSORTNAME, lang, sizeof(lang)/sizeof(TCHAR));
|
||||
|
||||
index = SendMessage(hwnd,
|
||||
CB_ADDSTRING,
|
||||
0,
|
||||
(LPARAM)lang);
|
||||
index = SendMessageW(hwnd,
|
||||
CB_ADDSTRING,
|
||||
0,
|
||||
(LPARAM)lang);
|
||||
|
||||
SendMessage(hwnd,
|
||||
CB_SETITEMDATA,
|
||||
index,
|
||||
(LPARAM)MAKELANGID(LANG_SPANISH, SUBLANG_SPANISH_MODERN));
|
||||
SendMessageW(hwnd,
|
||||
CB_SETITEMDATA,
|
||||
index,
|
||||
(LPARAM)MAKELANGID(LANG_SPANISH, SUBLANG_SPANISH_MODERN));
|
||||
}
|
||||
else
|
||||
{
|
||||
userLcid = lcid;
|
||||
|
||||
GetLocaleInfo(lcid & 0xFFFF, LOCALE_SSORTNAME, lang, sizeof(lang)/sizeof(TCHAR));
|
||||
GetLocaleInfoW(lcid & 0xFFFF, LOCALE_SSORTNAME, lang, sizeof(lang)/sizeof(WCHAR));
|
||||
|
||||
index = SendMessage(hWndSortList,
|
||||
CB_ADDSTRING,
|
||||
0,
|
||||
(LPARAM)lang);
|
||||
index = SendMessageW(hWndSortList,
|
||||
CB_ADDSTRING,
|
||||
0,
|
||||
(LPARAM)lang);
|
||||
|
||||
SendMessage(hWndSortList,
|
||||
CB_SETITEMDATA,
|
||||
index,
|
||||
(LPARAM)lcid & 0xFFFF);
|
||||
SendMessageW(hWndSortList,
|
||||
CB_SETITEMDATA,
|
||||
index,
|
||||
(LPARAM)lcid & 0xFFFF);
|
||||
|
||||
EnumSystemLocales(SortEnumProc, LCID_ALTERNATE_SORTS);
|
||||
EnumSystemLocalesW(SortEnumProc, LCID_ALTERNATE_SORTS);
|
||||
}
|
||||
|
||||
/* Select current locale */
|
||||
/* or should it be System and not user? */
|
||||
GetLocaleInfo(lcid, LOCALE_SSORTNAME, lang, sizeof(lang)/sizeof(TCHAR));
|
||||
GetLocaleInfoW(lcid, LOCALE_SSORTNAME, lang, sizeof(lang)/sizeof(WCHAR));
|
||||
|
||||
SendMessage(hwnd,
|
||||
CB_SELECTSTRING,
|
||||
-1,
|
||||
(LPARAM)lang);
|
||||
SendMessageW(hwnd,
|
||||
CB_SELECTSTRING,
|
||||
-1,
|
||||
(LPARAM)lang);
|
||||
}
|
||||
|
||||
/* Property page dialog callback */
|
||||
|
|
|
@ -28,9 +28,9 @@
|
|||
static HWND hwndEnum = NULL;
|
||||
|
||||
static BOOL CALLBACK
|
||||
TimeFormatEnumProc(LPTSTR lpTimeFormatString)
|
||||
TimeFormatEnumProc(PWSTR lpTimeFormatString)
|
||||
{
|
||||
SendMessage(hwndEnum,
|
||||
SendMessageW(hwndEnum,
|
||||
CB_ADDSTRING,
|
||||
0,
|
||||
(LPARAM)lpTimeFormatString);
|
||||
|
@ -41,15 +41,15 @@ TimeFormatEnumProc(LPTSTR lpTimeFormatString)
|
|||
static VOID
|
||||
UpdateTimeSample(HWND hWnd, LCID lcid)
|
||||
{
|
||||
TCHAR szBuffer[80];
|
||||
WCHAR szBuffer[80];
|
||||
|
||||
GetTimeFormat(lcid, 0, NULL, NULL, szBuffer, 80);
|
||||
SendMessage(hWnd, WM_SETTEXT, 0, (LPARAM)szBuffer);
|
||||
GetTimeFormatW(lcid, 0, NULL, NULL, szBuffer, 80);
|
||||
SendDlgItemMessageW(hWnd, IDC_TIMESAMPLE, WM_SETTEXT, 0, (LPARAM)szBuffer);
|
||||
}
|
||||
|
||||
|
||||
static VOID
|
||||
GetSelectedComboEntry(HWND hwndDlg, DWORD dwIdc, TCHAR *Buffer, UINT uSize)
|
||||
GetSelectedComboEntry(HWND hwndDlg, DWORD dwIdc, WCHAR *Buffer, UINT uSize)
|
||||
{
|
||||
int nIndex;
|
||||
HWND hChildWnd;
|
||||
|
@ -57,24 +57,24 @@ GetSelectedComboEntry(HWND hwndDlg, DWORD dwIdc, TCHAR *Buffer, UINT uSize)
|
|||
/* Get handle to time format control */
|
||||
hChildWnd = GetDlgItem(hwndDlg, dwIdc);
|
||||
/* Get index to selected time format */
|
||||
nIndex = SendMessage(hChildWnd, CB_GETCURSEL, 0, 0);
|
||||
nIndex = SendMessageW(hChildWnd, CB_GETCURSEL, 0, 0);
|
||||
if (nIndex == CB_ERR)
|
||||
/* No selection? Get content of the edit control */
|
||||
SendMessage(hChildWnd, WM_GETTEXT, uSize, (LPARAM)Buffer);
|
||||
SendMessageW(hChildWnd, WM_GETTEXT, uSize, (LPARAM)Buffer);
|
||||
else {
|
||||
LPTSTR tmp;
|
||||
PWSTR tmp;
|
||||
UINT uReqSize;
|
||||
|
||||
/* Get requested size, including the null terminator;
|
||||
* it shouldn't be required because the previous CB_LIMITTEXT,
|
||||
* but it would be better to check it anyways */
|
||||
uReqSize = SendMessage(hChildWnd, CB_GETLBTEXTLEN, (WPARAM)nIndex, 0) + 1;
|
||||
uReqSize = SendMessageW(hChildWnd, CB_GETLBTEXTLEN, (WPARAM)nIndex, 0) + 1;
|
||||
/* Allocate enough space to be more safe */
|
||||
tmp = (LPTSTR)_alloca(uReqSize*sizeof(TCHAR));
|
||||
tmp = (PWSTR)_alloca(uReqSize*sizeof(WCHAR));
|
||||
/* Get selected time format text */
|
||||
SendMessage(hChildWnd, CB_GETLBTEXT, (WPARAM)nIndex, (LPARAM)tmp);
|
||||
SendMessageW(hChildWnd, CB_GETLBTEXT, (WPARAM)nIndex, (LPARAM)tmp);
|
||||
/* Finally, copy the result into the output */
|
||||
_tcsncpy(Buffer, tmp, uSize);
|
||||
wcsncpy(Buffer, tmp, uSize);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -93,81 +93,81 @@ TimePageProc(HWND hwndDlg,
|
|||
{
|
||||
case WM_INITDIALOG:
|
||||
{
|
||||
TCHAR Buffer[80];
|
||||
WCHAR Buffer[80];
|
||||
int nLen;
|
||||
|
||||
pGlobalData = (PGLOBALDATA)((LPPROPSHEETPAGE)lParam)->lParam;
|
||||
SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pGlobalData);
|
||||
|
||||
/* Update the time format sample */
|
||||
UpdateTimeSample(GetDlgItem(hwndDlg, IDC_TIMESAMPLE), pGlobalData->lcid);
|
||||
UpdateTimeSample(hwndDlg, pGlobalData->lcid);
|
||||
|
||||
/* Get the time format */
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_TIMEFORMAT),
|
||||
CB_LIMITTEXT, MAX_TIMEFORMAT, 0);
|
||||
SendDlgItemMessageW(hwndDlg, IDC_TIMEFORMAT,
|
||||
CB_LIMITTEXT, MAX_TIMEFORMAT, 0);
|
||||
|
||||
/* Add available time formats to the list */
|
||||
hwndEnum = GetDlgItem(hwndDlg, IDC_TIMEFORMAT);
|
||||
EnumTimeFormats(TimeFormatEnumProc, pGlobalData->lcid, 0);
|
||||
EnumTimeFormatsW(TimeFormatEnumProc, pGlobalData->lcid, 0);
|
||||
|
||||
GetLocaleInfo(pGlobalData->lcid, LOCALE_STIMEFORMAT, Buffer, sizeof(Buffer)/sizeof(TCHAR));
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_TIMEFORMAT),
|
||||
CB_SELECTSTRING,
|
||||
-1,
|
||||
(LPARAM)Buffer);
|
||||
GetLocaleInfoW(pGlobalData->lcid, LOCALE_STIMEFORMAT, Buffer, sizeof(Buffer)/sizeof(WCHAR));
|
||||
SendDlgItemMessageW(hwndDlg, IDC_TIMEFORMAT,
|
||||
CB_SELECTSTRING,
|
||||
-1,
|
||||
(LPARAM)Buffer);
|
||||
|
||||
/* Get the time separator */
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_TIMESEPARATOR),
|
||||
SendDlgItemMessageW(hwndDlg, IDC_TIMESEPARATOR,
|
||||
CB_LIMITTEXT, MAX_TIMESEPARATOR, 0);
|
||||
GetLocaleInfo(pGlobalData->lcid, LOCALE_STIME, Buffer, sizeof(Buffer)/sizeof(TCHAR));
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_TIMESEPARATOR),
|
||||
CB_ADDSTRING,
|
||||
0,
|
||||
(LPARAM)Buffer);
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_TIMESEPARATOR),
|
||||
CB_SETCURSEL,
|
||||
0, /* Index */
|
||||
0);
|
||||
GetLocaleInfoW(pGlobalData->lcid, LOCALE_STIME, Buffer, sizeof(Buffer)/sizeof(WCHAR));
|
||||
SendDlgItemMessageW(hwndDlg, IDC_TIMESEPARATOR,
|
||||
CB_ADDSTRING,
|
||||
0,
|
||||
(LPARAM)Buffer);
|
||||
SendDlgItemMessageW(hwndDlg, IDC_TIMESEPARATOR,
|
||||
CB_SETCURSEL,
|
||||
0, /* Index */
|
||||
0);
|
||||
|
||||
/* Get the AM symbol */
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_TIMEAMSYMBOL),
|
||||
CB_LIMITTEXT, MAX_TIMEAMSYMBOL, 0);
|
||||
nLen = GetLocaleInfo(pGlobalData->lcid, LOCALE_S1159, Buffer, sizeof(Buffer)/sizeof(TCHAR));
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_TIMEAMSYMBOL),
|
||||
CB_ADDSTRING,
|
||||
0,
|
||||
(LPARAM)Buffer);
|
||||
SendDlgItemMessageW(hwndDlg, IDC_TIMEAMSYMBOL,
|
||||
CB_LIMITTEXT, MAX_TIMEAMSYMBOL, 0);
|
||||
nLen = GetLocaleInfoW(pGlobalData->lcid, LOCALE_S1159, Buffer, sizeof(Buffer)/sizeof(WCHAR));
|
||||
SendDlgItemMessageW(hwndDlg, IDC_TIMEAMSYMBOL,
|
||||
CB_ADDSTRING,
|
||||
0,
|
||||
(LPARAM)Buffer);
|
||||
if (nLen != 0)
|
||||
{
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_TIMEAMSYMBOL),
|
||||
CB_ADDSTRING,
|
||||
0,
|
||||
(LPARAM)_T(""));
|
||||
SendDlgItemMessageW(hwndDlg, IDC_TIMEAMSYMBOL,
|
||||
CB_ADDSTRING,
|
||||
0,
|
||||
(LPARAM)L"");
|
||||
}
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_TIMEAMSYMBOL),
|
||||
CB_SETCURSEL,
|
||||
0, /* Index */
|
||||
0);
|
||||
SendDlgItemMessageW(hwndDlg, IDC_TIMEAMSYMBOL,
|
||||
CB_SETCURSEL,
|
||||
0, /* Index */
|
||||
0);
|
||||
|
||||
/* Get the PM symbol */
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_TIMEPMSYMBOL),
|
||||
CB_LIMITTEXT, MAX_TIMEPMSYMBOL, 0);
|
||||
nLen = GetLocaleInfo(pGlobalData->lcid, LOCALE_S2359, Buffer, sizeof(Buffer)/sizeof(TCHAR));
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_TIMEPMSYMBOL),
|
||||
CB_ADDSTRING,
|
||||
0,
|
||||
(LPARAM)Buffer);
|
||||
SendDlgItemMessageW(hwndDlg, IDC_TIMEPMSYMBOL,
|
||||
CB_LIMITTEXT, MAX_TIMEPMSYMBOL, 0);
|
||||
nLen = GetLocaleInfoW(pGlobalData->lcid, LOCALE_S2359, Buffer, sizeof(Buffer)/sizeof(WCHAR));
|
||||
SendDlgItemMessageW(hwndDlg, IDC_TIMEPMSYMBOL,
|
||||
CB_ADDSTRING,
|
||||
0,
|
||||
(LPARAM)Buffer);
|
||||
if (nLen != 0)
|
||||
{
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_TIMEPMSYMBOL),
|
||||
CB_ADDSTRING,
|
||||
0,
|
||||
(LPARAM)_T(""));
|
||||
SendDlgItemMessageW(hwndDlg, IDC_TIMEPMSYMBOL,
|
||||
CB_ADDSTRING,
|
||||
0,
|
||||
(LPARAM)L"");
|
||||
}
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_TIMEPMSYMBOL),
|
||||
CB_SETCURSEL,
|
||||
0, /* Index */
|
||||
0);
|
||||
SendDlgItemMessageW(hwndDlg, IDC_TIMEPMSYMBOL,
|
||||
CB_SETCURSEL,
|
||||
0, /* Index */
|
||||
0);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -193,34 +193,34 @@ TimePageProc(HWND hwndDlg,
|
|||
|
||||
if (lpnm->code == (UINT)PSN_APPLY)
|
||||
{
|
||||
TCHAR Buffer[80];
|
||||
WCHAR Buffer[80];
|
||||
|
||||
/* Get selected/typed time format text */
|
||||
GetSelectedComboEntry(hwndDlg, IDC_TIMEFORMAT, Buffer, sizeof(Buffer)/sizeof(TCHAR));
|
||||
GetSelectedComboEntry(hwndDlg, IDC_TIMEFORMAT, Buffer, sizeof(Buffer)/sizeof(WCHAR));
|
||||
|
||||
/* Set time format */
|
||||
SetLocaleInfo(pGlobalData->lcid, LOCALE_STIMEFORMAT, Buffer);
|
||||
SetLocaleInfoW(pGlobalData->lcid, LOCALE_STIMEFORMAT, Buffer);
|
||||
|
||||
/* Get selected/typed time separator text */
|
||||
GetSelectedComboEntry(hwndDlg, IDC_TIMESEPARATOR, Buffer, sizeof(Buffer)/sizeof(TCHAR));
|
||||
GetSelectedComboEntry(hwndDlg, IDC_TIMESEPARATOR, Buffer, sizeof(Buffer)/sizeof(WCHAR));
|
||||
|
||||
/* Set time separator */
|
||||
SetLocaleInfo(pGlobalData->lcid, LOCALE_STIME, Buffer);
|
||||
SetLocaleInfoW(pGlobalData->lcid, LOCALE_STIME, Buffer);
|
||||
|
||||
/* Get selected/typed AM symbol text */
|
||||
GetSelectedComboEntry(hwndDlg, IDC_TIMEAMSYMBOL, Buffer, sizeof(Buffer)/sizeof(TCHAR));
|
||||
GetSelectedComboEntry(hwndDlg, IDC_TIMEAMSYMBOL, Buffer, sizeof(Buffer)/sizeof(WCHAR));
|
||||
|
||||
/* Set the AM symbol */
|
||||
SetLocaleInfo(pGlobalData->lcid, LOCALE_S1159, Buffer);
|
||||
SetLocaleInfoW(pGlobalData->lcid, LOCALE_S1159, Buffer);
|
||||
|
||||
/* Get selected/typed PM symbol text */
|
||||
GetSelectedComboEntry(hwndDlg, IDC_TIMEPMSYMBOL, Buffer, sizeof(Buffer)/sizeof(TCHAR));
|
||||
GetSelectedComboEntry(hwndDlg, IDC_TIMEPMSYMBOL, Buffer, sizeof(Buffer)/sizeof(WCHAR));
|
||||
|
||||
/* Set the PM symbol */
|
||||
SetLocaleInfo(pGlobalData->lcid, LOCALE_S2359, Buffer);
|
||||
SetLocaleInfoW(pGlobalData->lcid, LOCALE_S2359, Buffer);
|
||||
|
||||
/* Update the time format sample */
|
||||
UpdateTimeSample(GetDlgItem(hwndDlg, IDC_TIMESAMPLE), pGlobalData->lcid);
|
||||
UpdateTimeSample(hwndDlg, pGlobalData->lcid);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue