mirror of
https://github.com/reactos/reactos.git
synced 2025-08-07 04:03:02 +00:00
- Replace the hardcoded calls to Unicode-Functions. Use the module configuration to build a Unicode version instead.
- Cleaned up a lot of coding-style and indentation issues. - No code changes. svn path=/trunk/; revision=28876
This commit is contained in:
parent
9674b37837
commit
63d106c29f
13 changed files with 1168 additions and 1184 deletions
|
@ -8,16 +8,17 @@
|
||||||
/* Property page dialog callback */
|
/* Property page dialog callback */
|
||||||
INT_PTR CALLBACK
|
INT_PTR CALLBACK
|
||||||
AdvancedPageProc(HWND hwndDlg,
|
AdvancedPageProc(HWND hwndDlg,
|
||||||
UINT uMsg,
|
UINT uMsg,
|
||||||
WPARAM wParam,
|
WPARAM wParam,
|
||||||
LPARAM lParam)
|
LPARAM lParam)
|
||||||
{
|
{
|
||||||
switch(uMsg)
|
switch(uMsg)
|
||||||
{
|
{
|
||||||
case WM_INITDIALOG:
|
case WM_INITDIALOG:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return FALSE;
|
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -32,8 +32,8 @@
|
||||||
#include "intl.h"
|
#include "intl.h"
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
|
|
||||||
#define POSITIVE_EXAMPLE L"123456789.00"
|
#define POSITIVE_EXAMPLE _T("123456789.00")
|
||||||
#define NEGATIVE_EXAMPLE L"-123456789.00"
|
#define NEGATIVE_EXAMPLE _T("-123456789.00")
|
||||||
#define MAX_FIELD_DIG_SAMPLES 3
|
#define MAX_FIELD_DIG_SAMPLES 3
|
||||||
|
|
||||||
|
|
||||||
|
@ -90,9 +90,9 @@ GetInitialCurrencyValues(PGLOBAL_DATA pGlobalData)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get decimal separator */
|
/* Get decimal separator */
|
||||||
ret = GetLocaleInfoW(LOCALE_USER_DEFAULT,
|
ret = GetLocaleInfo(LOCALE_USER_DEFAULT,
|
||||||
LOCALE_SMONDECIMALSEP,
|
LOCALE_SMONDECIMALSEP,
|
||||||
pGlobalData->szDecimalSep, 4);
|
pGlobalData->szDecimalSep, 4);
|
||||||
|
|
||||||
/* Get group separator */
|
/* Get group separator */
|
||||||
ret = GetLocaleInfo(LOCALE_USER_DEFAULT,
|
ret = GetLocaleInfo(LOCALE_USER_DEFAULT,
|
||||||
|
@ -103,7 +103,6 @@ GetInitialCurrencyValues(PGLOBAL_DATA pGlobalData)
|
||||||
ret = GetLocaleInfo(LOCALE_USER_DEFAULT,
|
ret = GetLocaleInfo(LOCALE_USER_DEFAULT,
|
||||||
LOCALE_SMONGROUPING,
|
LOCALE_SMONGROUPING,
|
||||||
pGlobalData->szGrouping, 10);
|
pGlobalData->szGrouping, 10);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -123,18 +122,18 @@ UpdateExamples(HWND hwndDlg, PGLOBAL_DATA pGlobalData)
|
||||||
cyFmt.lpCurrencySymbol = pGlobalData->szCurrencySymbol;
|
cyFmt.lpCurrencySymbol = pGlobalData->szCurrencySymbol;
|
||||||
|
|
||||||
/* positive example */
|
/* positive example */
|
||||||
GetCurrencyFormatW(LOCALE_USER_DEFAULT, 0,
|
GetCurrencyFormat(LOCALE_USER_DEFAULT, 0,
|
||||||
POSITIVE_EXAMPLE,
|
POSITIVE_EXAMPLE,
|
||||||
&cyFmt, szBuffer, MAX_FMT_SIZE);
|
&cyFmt, szBuffer, MAX_FMT_SIZE);
|
||||||
|
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYPOSSAMPLE), WM_SETTEXT, 0, (LPARAM)szBuffer);
|
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYPOSSAMPLE), WM_SETTEXT, 0, (LPARAM)szBuffer);
|
||||||
|
|
||||||
/* negative example */
|
/* negative example */
|
||||||
GetCurrencyFormatW(LOCALE_USER_DEFAULT, 0,
|
GetCurrencyFormat(LOCALE_USER_DEFAULT, 0,
|
||||||
NEGATIVE_EXAMPLE,
|
NEGATIVE_EXAMPLE,
|
||||||
&cyFmt, szBuffer, MAX_FMT_SIZE);
|
&cyFmt, szBuffer, MAX_FMT_SIZE);
|
||||||
|
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYNEGSAMPLE), WM_SETTEXT, 0, (LPARAM)szBuffer);
|
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYNEGSAMPLE), WM_SETTEXT, 0, (LPARAM)szBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -148,12 +147,12 @@ OnInitDialog(HWND hwndDlg, PGLOBAL_DATA pGlobalData)
|
||||||
GetInitialCurrencyValues(pGlobalData);
|
GetInitialCurrencyValues(pGlobalData);
|
||||||
|
|
||||||
/* Set currency symbol */
|
/* Set currency symbol */
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYSYMBOL),
|
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYSYMBOL),
|
||||||
CB_ADDSTRING,
|
CB_ADDSTRING,
|
||||||
0,
|
0,
|
||||||
(LPARAM)pGlobalData->szCurrencySymbol);
|
(LPARAM)pGlobalData->szCurrencySymbol);
|
||||||
|
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYSYMBOL),
|
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYSYMBOL),
|
||||||
CB_SETCURSEL,
|
CB_SETCURSEL,
|
||||||
0, /* index */
|
0, /* index */
|
||||||
0);
|
0);
|
||||||
|
@ -175,13 +174,13 @@ OnInitDialog(HWND hwndDlg, PGLOBAL_DATA pGlobalData)
|
||||||
_T("1.1"),
|
_T("1.1"),
|
||||||
&cyFmt, szBuffer, MAX_FMT_SIZE);
|
&cyFmt, szBuffer, MAX_FMT_SIZE);
|
||||||
|
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYPOSVALUE),
|
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYPOSVALUE),
|
||||||
CB_INSERTSTRING,
|
CB_INSERTSTRING,
|
||||||
-1,
|
-1,
|
||||||
(LPARAM)szBuffer);
|
(LPARAM)szBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYPOSVALUE),
|
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYPOSVALUE),
|
||||||
CB_SETCURSEL,
|
CB_SETCURSEL,
|
||||||
pGlobalData->PositiveOrder,
|
pGlobalData->PositiveOrder,
|
||||||
0);
|
0);
|
||||||
|
@ -195,53 +194,52 @@ OnInitDialog(HWND hwndDlg, PGLOBAL_DATA pGlobalData)
|
||||||
_T("-1.1"),
|
_T("-1.1"),
|
||||||
&cyFmt, szBuffer, MAX_FMT_SIZE);
|
&cyFmt, szBuffer, MAX_FMT_SIZE);
|
||||||
|
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYNEGVALUE),
|
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYNEGVALUE),
|
||||||
CB_INSERTSTRING,
|
CB_INSERTSTRING,
|
||||||
-1,
|
-1,
|
||||||
(LPARAM)szBuffer);
|
(LPARAM)szBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYNEGVALUE),
|
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYNEGVALUE),
|
||||||
CB_SETCURSEL,
|
CB_SETCURSEL,
|
||||||
pGlobalData->NegativeOrder, /* index */
|
pGlobalData->NegativeOrder, /* index */
|
||||||
0);
|
0);
|
||||||
|
|
||||||
/* decimal separator */
|
/* decimal separator */
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYDECSEP),
|
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYDECSEP),
|
||||||
CB_ADDSTRING,
|
CB_ADDSTRING,
|
||||||
0,
|
0,
|
||||||
(LPARAM)pGlobalData->szDecimalSep);
|
(LPARAM)pGlobalData->szDecimalSep);
|
||||||
|
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYDECSEP),
|
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYDECSEP),
|
||||||
CB_SETCURSEL,
|
CB_SETCURSEL,
|
||||||
0, /* index */
|
0, /* index */
|
||||||
0);
|
0);
|
||||||
|
|
||||||
|
|
||||||
/* */
|
/* */
|
||||||
for (i = 0; i < 10; i++)
|
for (i = 0; i < 10; i++)
|
||||||
{
|
{
|
||||||
szBuffer[0] = _T('0') + i;
|
szBuffer[0] = _T('0') + i;
|
||||||
szBuffer[1] = 0;
|
szBuffer[1] = 0;
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYDECNUM),
|
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYDECNUM),
|
||||||
CB_ADDSTRING,
|
CB_ADDSTRING,
|
||||||
0,
|
0,
|
||||||
(LPARAM)szBuffer);
|
(LPARAM)szBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYDECNUM),
|
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYDECNUM),
|
||||||
CB_SETCURSEL,
|
CB_SETCURSEL,
|
||||||
pGlobalData->NumDigits, /* index */
|
pGlobalData->NumDigits, /* index */
|
||||||
0);
|
0);
|
||||||
|
|
||||||
|
|
||||||
/* digit group separator */
|
/* digit group separator */
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYGRPSEP),
|
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYGRPSEP),
|
||||||
CB_ADDSTRING,
|
CB_ADDSTRING,
|
||||||
0,
|
0,
|
||||||
(LPARAM)pGlobalData->szThousandSep);
|
(LPARAM)pGlobalData->szThousandSep);
|
||||||
|
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYGRPSEP),
|
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYGRPSEP),
|
||||||
CB_SETCURSEL,
|
CB_SETCURSEL,
|
||||||
0, /* index */
|
0, /* index */
|
||||||
0);
|
0);
|
||||||
|
@ -257,7 +255,7 @@ OnInitDialog(HWND hwndDlg, PGLOBAL_DATA pGlobalData)
|
||||||
GetCurrencyFormat(LOCALE_USER_DEFAULT, 0,
|
GetCurrencyFormat(LOCALE_USER_DEFAULT, 0,
|
||||||
_T("123456789"),
|
_T("123456789"),
|
||||||
&cyFmt, szBuffer, MAX_FMT_SIZE);
|
&cyFmt, szBuffer, MAX_FMT_SIZE);
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYGRPNUM),
|
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYGRPNUM),
|
||||||
CB_INSERTSTRING,
|
CB_INSERTSTRING,
|
||||||
-1,
|
-1,
|
||||||
(LPARAM)szBuffer);
|
(LPARAM)szBuffer);
|
||||||
|
@ -266,7 +264,7 @@ OnInitDialog(HWND hwndDlg, PGLOBAL_DATA pGlobalData)
|
||||||
GetCurrencyFormat(LOCALE_USER_DEFAULT, 0,
|
GetCurrencyFormat(LOCALE_USER_DEFAULT, 0,
|
||||||
_T("123456789"),
|
_T("123456789"),
|
||||||
&cyFmt, szBuffer, MAX_FMT_SIZE);
|
&cyFmt, szBuffer, MAX_FMT_SIZE);
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYGRPNUM),
|
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYGRPNUM),
|
||||||
CB_INSERTSTRING,
|
CB_INSERTSTRING,
|
||||||
-1,
|
-1,
|
||||||
(LPARAM)szBuffer);
|
(LPARAM)szBuffer);
|
||||||
|
@ -275,7 +273,7 @@ OnInitDialog(HWND hwndDlg, PGLOBAL_DATA pGlobalData)
|
||||||
GetCurrencyFormat(LOCALE_USER_DEFAULT, 0,
|
GetCurrencyFormat(LOCALE_USER_DEFAULT, 0,
|
||||||
_T("123456789"),
|
_T("123456789"),
|
||||||
&cyFmt, szBuffer, MAX_FMT_SIZE);
|
&cyFmt, szBuffer, MAX_FMT_SIZE);
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYGRPNUM),
|
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYGRPNUM),
|
||||||
CB_INSERTSTRING,
|
CB_INSERTSTRING,
|
||||||
-1,
|
-1,
|
||||||
(LPARAM)szBuffer);
|
(LPARAM)szBuffer);
|
||||||
|
@ -290,7 +288,7 @@ OnInitDialog(HWND hwndDlg, PGLOBAL_DATA pGlobalData)
|
||||||
i = 1;
|
i = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYGRPNUM),
|
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYGRPNUM),
|
||||||
CB_SETCURSEL,
|
CB_SETCURSEL,
|
||||||
i, /* index */
|
i, /* index */
|
||||||
0);
|
0);
|
||||||
|
@ -300,149 +298,148 @@ OnInitDialog(HWND hwndDlg, PGLOBAL_DATA pGlobalData)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set number of digidts in field */
|
/* Set number of digidts in field */
|
||||||
BOOL
|
static BOOL
|
||||||
SetCurrencyDigNum(HWND hwndDlg)
|
SetCurrencyDigNum(HWND hwndDlg)
|
||||||
{
|
{
|
||||||
WCHAR wszFieldDigNumSamples[MAX_FIELD_DIG_SAMPLES][MAX_SAMPLES_STR_SIZE]=
|
TCHAR szFieldDigNumSamples[MAX_FIELD_DIG_SAMPLES][MAX_SAMPLES_STR_SIZE]=
|
||||||
{
|
{
|
||||||
L"0;0",
|
_T("0;0"),
|
||||||
L"3;0",
|
_T("3;0"),
|
||||||
L"3;2;0"
|
_T("3;2;0")
|
||||||
};
|
};
|
||||||
|
|
||||||
int nCurrSel;
|
int nCurrSel;
|
||||||
|
|
||||||
/* Get setted number of digidts in field */
|
/* Get setted number of digidts in field */
|
||||||
nCurrSel=SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYGRPNUM),
|
nCurrSel = SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYGRPNUM),
|
||||||
CB_GETCURSEL,
|
CB_GETCURSEL,
|
||||||
(WPARAM)0,
|
(WPARAM)0,
|
||||||
(LPARAM)0);
|
(LPARAM)0);
|
||||||
|
|
||||||
/* Save number of digidts in field */
|
/* Save number of digidts in field */
|
||||||
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SMONGROUPING, wszFieldDigNumSamples[nCurrSel]);
|
SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SMONGROUPING, szFieldDigNumSamples[nCurrSel]);
|
||||||
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set currency field separator */
|
/* Set currency field separator */
|
||||||
BOOL
|
static BOOL
|
||||||
SetCurrencyFieldSep(HWND hwndDlg)
|
SetCurrencyFieldSep(HWND hwndDlg)
|
||||||
{
|
{
|
||||||
WCHAR wszCurrencyFieldSep[MAX_SAMPLES_STR_SIZE];
|
TCHAR szCurrencyFieldSep[MAX_SAMPLES_STR_SIZE];
|
||||||
|
|
||||||
/* Get setted currency field separator */
|
/* Get setted currency field separator */
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYGRPSEP),
|
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYGRPSEP),
|
||||||
WM_GETTEXT,
|
WM_GETTEXT,
|
||||||
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
||||||
(LPARAM)(LPCSTR)wszCurrencyFieldSep);
|
(LPARAM)szCurrencyFieldSep);
|
||||||
|
|
||||||
/* Save currency field separator */
|
/* Save currency field separator */
|
||||||
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SMONTHOUSANDSEP, wszCurrencyFieldSep);
|
SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SMONTHOUSANDSEP, szCurrencyFieldSep);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set number of fractional symbols */
|
/* Set number of fractional symbols */
|
||||||
BOOL
|
static BOOL
|
||||||
SetCurrencyFracSymNum(HWND hwndDlg)
|
SetCurrencyFracSymNum(HWND hwndDlg)
|
||||||
{
|
{
|
||||||
WCHAR wszCurrencyFracSymNum[MAX_SAMPLES_STR_SIZE];
|
TCHAR szCurrencyFracSymNum[MAX_SAMPLES_STR_SIZE];
|
||||||
INT nCurrSel;
|
INT nCurrSel;
|
||||||
|
|
||||||
/* Get setted number of fractional symbols */
|
/* Get setted number of fractional symbols */
|
||||||
nCurrSel=SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYDECNUM),
|
nCurrSel = SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYDECNUM),
|
||||||
CB_GETCURSEL,
|
CB_GETCURSEL,
|
||||||
(WPARAM)0,
|
(WPARAM)0,
|
||||||
(LPARAM)0);
|
(LPARAM)0);
|
||||||
|
|
||||||
/* convert to wide char */
|
/* convert to wide char */
|
||||||
_itow(nCurrSel,wszCurrencyFracSymNum,DECIMAL_RADIX);
|
_itot(nCurrSel, szCurrencyFracSymNum, DECIMAL_RADIX);
|
||||||
|
|
||||||
/* Save number of fractional symbols */
|
/* Save number of fractional symbols */
|
||||||
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_ICURRDIGITS, wszCurrencyFracSymNum);
|
SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_ICURRDIGITS, szCurrencyFracSymNum);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set currency separator */
|
/* Set currency separator */
|
||||||
BOOL
|
static BOOL
|
||||||
SetCurrencySep(HWND hwndDlg)
|
SetCurrencySep(HWND hwndDlg)
|
||||||
{
|
{
|
||||||
WCHAR wszCurrencySep[MAX_SAMPLES_STR_SIZE];
|
TCHAR szCurrencySep[MAX_SAMPLES_STR_SIZE];
|
||||||
|
|
||||||
/* Get setted currency decimal separator */
|
/* Get setted currency decimal separator */
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYDECSEP),
|
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYDECSEP),
|
||||||
WM_GETTEXT,
|
WM_GETTEXT,
|
||||||
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
||||||
(LPARAM)(LPCSTR)wszCurrencySep);
|
(LPARAM)szCurrencySep);
|
||||||
|
|
||||||
/* TODO: Add check for correctly input */
|
/* TODO: Add check for correctly input */
|
||||||
|
|
||||||
/* Save currency separator */
|
/* Save currency separator */
|
||||||
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SMONDECIMALSEP, wszCurrencySep);
|
SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SMONDECIMALSEP, szCurrencySep);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set negative currency sum format */
|
/* Set negative currency sum format */
|
||||||
BOOL
|
static BOOL
|
||||||
SetNegCurrencySumFmt(HWND hwndDlg)
|
SetNegCurrencySumFmt(HWND hwndDlg)
|
||||||
{
|
{
|
||||||
WCHAR wszNegCurrencySumFmt[MAX_SAMPLES_STR_SIZE];
|
TCHAR szNegCurrencySumFmt[MAX_SAMPLES_STR_SIZE];
|
||||||
INT nCurrSel;
|
INT nCurrSel;
|
||||||
|
|
||||||
/* Get setted currency unit */
|
/* Get setted currency unit */
|
||||||
nCurrSel=SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYNEGVALUE),
|
nCurrSel = SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYNEGVALUE),
|
||||||
CB_GETCURSEL,
|
CB_GETCURSEL,
|
||||||
(WPARAM)0,
|
(WPARAM)0,
|
||||||
(LPARAM)0);
|
(LPARAM)0);
|
||||||
|
|
||||||
/* convert to wide char */
|
/* convert to wide char */
|
||||||
_itow(nCurrSel,wszNegCurrencySumFmt,DECIMAL_RADIX);
|
_itot(nCurrSel, szNegCurrencySumFmt, DECIMAL_RADIX);
|
||||||
|
|
||||||
/* Save currency sum format */
|
/* Save currency sum format */
|
||||||
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_INEGCURR, wszNegCurrencySumFmt);
|
SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_INEGCURR, szNegCurrencySumFmt);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set positive currency sum format */
|
/* Set positive currency sum format */
|
||||||
BOOL
|
static BOOL
|
||||||
SetPosCurrencySumFmt(HWND hwndDlg)
|
SetPosCurrencySumFmt(HWND hwndDlg)
|
||||||
{
|
{
|
||||||
WCHAR wszPosCurrencySumFmt[MAX_SAMPLES_STR_SIZE];
|
TCHAR szPosCurrencySumFmt[MAX_SAMPLES_STR_SIZE];
|
||||||
INT nCurrSel;
|
INT nCurrSel;
|
||||||
|
|
||||||
/* Get setted currency unit */
|
/* Get setted currency unit */
|
||||||
nCurrSel=SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYPOSVALUE),
|
nCurrSel = SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYPOSVALUE),
|
||||||
CB_GETCURSEL,
|
CB_GETCURSEL,
|
||||||
(WPARAM)0,
|
(WPARAM)0,
|
||||||
(LPARAM)0);
|
(LPARAM)0);
|
||||||
|
|
||||||
/* convert to wide char */
|
/* convert to wide char */
|
||||||
_itow(nCurrSel,wszPosCurrencySumFmt,DECIMAL_RADIX);
|
_itot(nCurrSel, szPosCurrencySumFmt, DECIMAL_RADIX);
|
||||||
|
|
||||||
/* Save currency sum format */
|
/* Save currency sum format */
|
||||||
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_ICURRENCY, wszPosCurrencySumFmt);
|
SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_ICURRENCY, szPosCurrencySumFmt);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set currency unit */
|
/* Set currency unit */
|
||||||
BOOL
|
static BOOL
|
||||||
SetCurrencyUnit(HWND hwndDlg)
|
SetCurrencyUnit(HWND hwndDlg)
|
||||||
{
|
{
|
||||||
WCHAR wszCurrencyUnit[MAX_SAMPLES_STR_SIZE];
|
TCHAR szCurrencyUnit[MAX_SAMPLES_STR_SIZE];
|
||||||
|
|
||||||
/* Get setted currency unit */
|
/* Get setted currency unit */
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYSYMBOL),
|
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYSYMBOL),
|
||||||
WM_GETTEXT,
|
WM_GETTEXT,
|
||||||
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
||||||
(LPARAM)(LPCSTR)wszCurrencyUnit);
|
(LPARAM)(LPCSTR)szCurrencyUnit);
|
||||||
|
|
||||||
/* Save currency unit */
|
/* Save currency unit */
|
||||||
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SCURRENCY, wszCurrencyUnit);
|
SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SCURRENCY, szCurrencyUnit);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -461,48 +458,61 @@ CurrencyPageProc(HWND hwndDlg,
|
||||||
switch (uMsg)
|
switch (uMsg)
|
||||||
{
|
{
|
||||||
case WM_INITDIALOG:
|
case WM_INITDIALOG:
|
||||||
{
|
|
||||||
pGlobalData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(GLOBAL_DATA));
|
pGlobalData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(GLOBAL_DATA));
|
||||||
SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pGlobalData);
|
SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pGlobalData);
|
||||||
OnInitDialog(hwndDlg, pGlobalData);
|
OnInitDialog(hwndDlg, pGlobalData);
|
||||||
}
|
break;
|
||||||
break;
|
|
||||||
case WM_COMMAND:
|
case WM_COMMAND:
|
||||||
{
|
switch (LOWORD(wParam))
|
||||||
switch (LOWORD(wParam))
|
{
|
||||||
{
|
case IDC_CURRENCYSYMBOL:
|
||||||
case IDC_CURRENCYSYMBOL:
|
case IDC_CURRENCYPOSVALUE:
|
||||||
case IDC_CURRENCYPOSVALUE:
|
case IDC_CURRENCYNEGVALUE:
|
||||||
case IDC_CURRENCYNEGVALUE:
|
case IDC_CURRENCYDECSEP:
|
||||||
case IDC_CURRENCYDECSEP:
|
case IDC_CURRENCYDECNUM:
|
||||||
case IDC_CURRENCYDECNUM:
|
case IDC_CURRENCYGRPSEP:
|
||||||
case IDC_CURRENCYGRPSEP:
|
case IDC_CURRENCYGRPNUM:
|
||||||
case IDC_CURRENCYGRPNUM:
|
if (HIWORD(wParam) == CBN_SELCHANGE || HIWORD(wParam) == CBN_EDITCHANGE)
|
||||||
if (HIWORD(wParam) == CBN_SELCHANGE || HIWORD(wParam) == CBN_EDITCHANGE)
|
{
|
||||||
{
|
/* Set "Apply" button enabled */
|
||||||
/* Set "Apply" button enabled */
|
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
||||||
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
}
|
||||||
}
|
}
|
||||||
}
|
break;
|
||||||
}
|
|
||||||
break;
|
case WM_NOTIFY:
|
||||||
case WM_NOTIFY:
|
{
|
||||||
{
|
LPNMHDR lpnm = (LPNMHDR)lParam;
|
||||||
LPNMHDR lpnm = (LPNMHDR)lParam;
|
/* If push apply button */
|
||||||
/* If push apply button */
|
if (lpnm->code == (UINT)PSN_APPLY)
|
||||||
if (lpnm->code == (UINT)PSN_APPLY)
|
{
|
||||||
{
|
if (!SetCurrencyDigNum(hwndDlg))
|
||||||
if(!SetCurrencyDigNum(hwndDlg)) break;
|
break;
|
||||||
if(!SetCurrencyUnit(hwndDlg)) break;
|
|
||||||
if(!SetPosCurrencySumFmt(hwndDlg)) break;
|
if (!SetCurrencyUnit(hwndDlg))
|
||||||
if(!SetNegCurrencySumFmt(hwndDlg)) break;
|
break;
|
||||||
if(!SetCurrencySep(hwndDlg)) break;
|
|
||||||
if(!SetCurrencyFracSymNum(hwndDlg)) break;
|
if (!SetPosCurrencySumFmt(hwndDlg))
|
||||||
if(!SetCurrencyFieldSep(hwndDlg)) break;
|
break;
|
||||||
UpdateExamples(hwndDlg, pGlobalData);
|
|
||||||
}
|
if (!SetNegCurrencySumFmt(hwndDlg))
|
||||||
}
|
break;
|
||||||
break;
|
|
||||||
|
if (!SetCurrencySep(hwndDlg))
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (!SetCurrencyFracSymNum(hwndDlg))
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (!SetCurrencyFieldSep(hwndDlg))
|
||||||
|
break;
|
||||||
|
|
||||||
|
UpdateExamples(hwndDlg, pGlobalData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case WM_DESTROY:
|
case WM_DESTROY:
|
||||||
HeapFree(GetProcessHeap(), 0, pGlobalData);
|
HeapFree(GetProcessHeap(), 0, pGlobalData);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -24,23 +24,21 @@
|
||||||
* PROGRAMMER: Eric Kohl
|
* PROGRAMMER: Eric Kohl
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define WINVER 0x0500
|
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <commctrl.h>
|
#include <commctrl.h>
|
||||||
#include <cpl.h>
|
#include <cpl.h>
|
||||||
|
#include <tchar.h>
|
||||||
|
|
||||||
#include "intl.h"
|
#include "intl.h"
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
|
|
||||||
/* GLOBALS ******************************************************************/
|
/* GLOBALS ******************************************************************/
|
||||||
|
|
||||||
const INT YEAR_STR_MAX_SIZE=4;
|
#define YEAR_STR_MAX_SIZE 4
|
||||||
const INT EOLN_SIZE=sizeof(WCHAR); /* size of EOLN char */
|
|
||||||
#define MAX_SHORT_FMT_SAMPLES 5
|
#define MAX_SHORT_FMT_SAMPLES 5
|
||||||
#define MAX_LONG_FMT_SAMPLES 2
|
#define MAX_LONG_FMT_SAMPLES 2
|
||||||
#define MAX_SHRT_DATE_SEPARATORS 3
|
#define MAX_SHRT_DATE_SEPARATORS 3
|
||||||
#define STD_DATE_SEP L"."
|
#define STD_DATE_SEP _T(".")
|
||||||
#define YEAR_DIFF (99)
|
#define YEAR_DIFF (99)
|
||||||
#define MAX_YEAR (9999)
|
#define MAX_YEAR (9999)
|
||||||
|
|
||||||
|
@ -48,231 +46,231 @@ const INT EOLN_SIZE=sizeof(WCHAR); /* size of EOLN char */
|
||||||
|
|
||||||
/* if char is 'y' or 'M' or 'd' return TRUE, else FALSE */
|
/* if char is 'y' or 'M' or 'd' return TRUE, else FALSE */
|
||||||
BOOL
|
BOOL
|
||||||
isDateCompAl(WCHAR walpha)
|
isDateCompAl(TCHAR alpha)
|
||||||
{
|
{
|
||||||
|
if ((alpha == _T('y')) || (alpha == _T('M')) || (alpha == _T('d')) || (alpha == _T(' ')))
|
||||||
if((walpha == L'y') || (walpha == L'M') || (walpha == L'd') || (walpha == L' ')) return TRUE;
|
return TRUE;
|
||||||
else return FALSE;
|
else
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Find first date separator in string */
|
/* Find first date separator in string */
|
||||||
WCHAR*
|
LPTSTR
|
||||||
FindDateSep(const WCHAR *wszSourceStr)
|
FindDateSep(const TCHAR *szSourceStr)
|
||||||
{
|
{
|
||||||
int nDateCompCount=0;
|
LPTSTR pszFoundSep;
|
||||||
int nDateSepCount=0;
|
INT nDateCompCount=0;
|
||||||
|
INT nDateSepCount=0;
|
||||||
|
|
||||||
WCHAR* wszFindedSep;
|
pszFoundSep = (LPTSTR)malloc(MAX_SAMPLES_STR_SIZE * sizeof(TCHAR));
|
||||||
wszFindedSep=(WCHAR*) malloc(MAX_SAMPLES_STR_SIZE*sizeof(WCHAR));
|
|
||||||
|
|
||||||
wcscpy(wszFindedSep,STD_DATE_SEP);
|
_tcscpy(pszFoundSep,STD_DATE_SEP);
|
||||||
|
|
||||||
while(nDateCompCount<wcslen(wszSourceStr))
|
while (nDateCompCount < _tcslen(szSourceStr))
|
||||||
{
|
{
|
||||||
if(!isDateCompAl(wszSourceStr[nDateCompCount]) && (wszSourceStr[nDateCompCount]!=L'\''))
|
if (!isDateCompAl(szSourceStr[nDateCompCount]) && (szSourceStr[nDateCompCount] != _T('\'')))
|
||||||
{
|
{
|
||||||
while(!isDateCompAl(wszSourceStr[nDateCompCount]) && (wszSourceStr[nDateCompCount]!=L'\''))
|
while (!isDateCompAl(szSourceStr[nDateCompCount]) && (szSourceStr[nDateCompCount] != _T('\'')))
|
||||||
{
|
{
|
||||||
wszFindedSep[nDateSepCount++]=wszSourceStr[nDateCompCount];
|
pszFoundSep[nDateSepCount++] = szSourceStr[nDateCompCount];
|
||||||
nDateCompCount++;
|
nDateCompCount++;
|
||||||
}
|
}
|
||||||
wszFindedSep[nDateSepCount]='\0';
|
|
||||||
return wszFindedSep;
|
pszFoundSep[nDateSepCount] = _T('\0');
|
||||||
|
return pszFoundSep;
|
||||||
}
|
}
|
||||||
|
|
||||||
nDateCompCount++;
|
nDateCompCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return wszFindedSep;
|
return pszFoundSep;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Replace given template in source string with string to replace and return recieved string */
|
/* Replace given template in source string with string to replace and return recieved string */
|
||||||
|
|
||||||
|
|
||||||
/* Setted up short date separator to registry */
|
/* Setted up short date separator to registry */
|
||||||
BOOL
|
static BOOL
|
||||||
SetShortDateSep(HWND hwndDlg)
|
SetShortDateSep(HWND hwndDlg)
|
||||||
{
|
{
|
||||||
WCHAR wszShortDateSep[MAX_SAMPLES_STR_SIZE];
|
TCHAR szShortDateSep[MAX_SAMPLES_STR_SIZE];
|
||||||
int nSepStrSize;
|
INT nSepStrSize;
|
||||||
int nSepCount;
|
INT nSepCount;
|
||||||
|
|
||||||
/* Get setted separator */
|
/* Get setted separator */
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_SHRTDATESEP_COMBO),
|
SendMessage(GetDlgItem(hwndDlg, IDC_SHRTDATESEP_COMBO),
|
||||||
WM_GETTEXT,
|
WM_GETTEXT,
|
||||||
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
||||||
(LPARAM)(LPCSTR)wszShortDateSep);
|
(LPARAM)szShortDateSep);
|
||||||
|
|
||||||
/* Get setted separator string size */
|
/* Get setted separator string size */
|
||||||
nSepStrSize = wcslen(wszShortDateSep);
|
nSepStrSize = _tcslen(szShortDateSep);
|
||||||
|
|
||||||
/* Check date components */
|
/* Check date components */
|
||||||
for(nSepCount=0;nSepCount<nSepStrSize;nSepCount++)
|
for (nSepCount = 0; nSepCount < nSepStrSize; nSepCount++)
|
||||||
{
|
{
|
||||||
if(iswalnum(wszShortDateSep[nSepCount]) || (wszShortDateSep[nSepCount]=='\''))
|
if (_istalnum(szShortDateSep[nSepCount]) || (szShortDateSep[nSepCount] == _T('\'')))
|
||||||
{
|
{
|
||||||
MessageBoxW(NULL,
|
MessageBox(NULL,
|
||||||
L"Entered short date separator contain incorrect symbol",
|
_T("Entered short date separator contain incorrect symbol"),
|
||||||
L"Error", MB_OK | MB_ICONERROR);
|
_T("Error"), MB_OK | MB_ICONERROR);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Save date separator */
|
/* Save date separator */
|
||||||
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SDATE, wszShortDateSep);
|
SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SDATE, szShortDateSep);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Setted up short date format to registry */
|
/* Setted up short date format to registry */
|
||||||
BOOL
|
static BOOL
|
||||||
SetShortDateFormat(HWND hwndDlg)
|
SetShortDateFormat(HWND hwndDlg)
|
||||||
{
|
{
|
||||||
WCHAR wszShortDateFmt[MAX_SAMPLES_STR_SIZE];
|
TCHAR szShortDateFmt[MAX_SAMPLES_STR_SIZE];
|
||||||
WCHAR wszShortDateSep[MAX_SAMPLES_STR_SIZE];
|
TCHAR szShortDateSep[MAX_SAMPLES_STR_SIZE];
|
||||||
WCHAR wszFindedDateSep[MAX_SAMPLES_STR_SIZE];
|
TCHAR szFindedDateSep[MAX_SAMPLES_STR_SIZE];
|
||||||
|
LPTSTR pszResultStr;
|
||||||
WCHAR* pwszResultStr;
|
|
||||||
BOOL OpenApostFlg = FALSE;
|
BOOL OpenApostFlg = FALSE;
|
||||||
int nFmtStrSize;
|
INT nFmtStrSize;
|
||||||
int nDateCompCount;
|
INT nDateCompCount;
|
||||||
|
|
||||||
/* Get setted format */
|
/* Get setted format */
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_SHRTDATEFMT_COMBO),
|
SendMessage(GetDlgItem(hwndDlg, IDC_SHRTDATEFMT_COMBO),
|
||||||
WM_GETTEXT,
|
WM_GETTEXT,
|
||||||
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
||||||
(LPARAM)(LPCSTR)wszShortDateFmt);
|
(LPARAM)szShortDateFmt);
|
||||||
|
|
||||||
/* Get setted separator */
|
/* Get setted separator */
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_SHRTDATESEP_COMBO),
|
SendMessage(GetDlgItem(hwndDlg, IDC_SHRTDATESEP_COMBO),
|
||||||
WM_GETTEXT,
|
WM_GETTEXT,
|
||||||
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
||||||
(LPARAM)(LPCSTR)wszShortDateSep);
|
(LPARAM)szShortDateSep);
|
||||||
|
|
||||||
/* Get setted format-string size */
|
/* Get setted format-string size */
|
||||||
nFmtStrSize = wcslen(wszShortDateFmt);
|
nFmtStrSize = _tcslen(szShortDateFmt);
|
||||||
|
|
||||||
/* Check date components */
|
/* Check date components */
|
||||||
for(nDateCompCount=0;nDateCompCount<nFmtStrSize;nDateCompCount++)
|
for (nDateCompCount = 0; nDateCompCount < nFmtStrSize; nDateCompCount++)
|
||||||
{
|
{
|
||||||
if(wszShortDateFmt[nDateCompCount]==L'\'')
|
if (szShortDateFmt[nDateCompCount] == _T('\''))
|
||||||
{
|
{
|
||||||
OpenApostFlg=!OpenApostFlg;
|
OpenApostFlg = !OpenApostFlg;
|
||||||
}
|
}
|
||||||
if(iswalnum(wszShortDateFmt[nDateCompCount]) &&
|
|
||||||
!isDateCompAl(wszShortDateFmt[nDateCompCount]) &&
|
if (_istalnum(szShortDateFmt[nDateCompCount]) &&
|
||||||
!OpenApostFlg)
|
!isDateCompAl(szShortDateFmt[nDateCompCount]) &&
|
||||||
|
!OpenApostFlg)
|
||||||
{
|
{
|
||||||
MessageBoxW(NULL,
|
MessageBox(NULL,
|
||||||
L"Entered short date format contain incorrect symbol",
|
_T("Entered short date format contain incorrect symbol"),
|
||||||
L"Error", MB_OK | MB_ICONERROR);
|
_T("Error"), MB_OK | MB_ICONERROR);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(OpenApostFlg)
|
if (OpenApostFlg)
|
||||||
{
|
{
|
||||||
MessageBoxW(NULL,
|
MessageBoxW(NULL,
|
||||||
L"Entered short date format contain incorrect symbol",
|
_T("Entered short date format contain incorrect symbol"),
|
||||||
L"Error", MB_OK | MB_ICONERROR);
|
_T("Error"), MB_OK | MB_ICONERROR);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* substring replacement of separator */
|
/* substring replacement of separator */
|
||||||
wcscpy(wszFindedDateSep,FindDateSep(wszShortDateFmt));
|
_tcscpy(szFindedDateSep, FindDateSep(szShortDateFmt));
|
||||||
pwszResultStr = ReplaceSubStr(wszShortDateFmt,wszShortDateSep,wszFindedDateSep);
|
pszResultStr = ReplaceSubStr(szShortDateFmt, szShortDateSep, szFindedDateSep);
|
||||||
wcscpy(wszShortDateFmt,pwszResultStr);
|
_tcscpy(szShortDateFmt, pszResultStr);
|
||||||
free(pwszResultStr);
|
free(pszResultStr);
|
||||||
|
|
||||||
/* Save short date format */
|
/* Save short date format */
|
||||||
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SSHORTDATE, wszShortDateFmt);
|
SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SSHORTDATE, szShortDateFmt);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Setted up long date format to registry */
|
/* Setted up long date format to registry */
|
||||||
BOOL
|
static BOOL
|
||||||
SetLongDateFormat(HWND hwndDlg)
|
SetLongDateFormat(HWND hwndDlg)
|
||||||
{
|
{
|
||||||
WCHAR wszLongDateFmt[MAX_SAMPLES_STR_SIZE];
|
TCHAR szLongDateFmt[MAX_SAMPLES_STR_SIZE];
|
||||||
BOOL OpenApostFlg = FALSE;
|
BOOL OpenApostFlg = FALSE;
|
||||||
int nFmtStrSize;
|
INT nFmtStrSize;
|
||||||
int nDateCompCount;
|
INT nDateCompCount;
|
||||||
|
|
||||||
/* Get setted format */
|
/* Get setted format */
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_LONGDATEFMT_COMBO),
|
SendMessage(GetDlgItem(hwndDlg, IDC_LONGDATEFMT_COMBO),
|
||||||
WM_GETTEXT,
|
WM_GETTEXT,
|
||||||
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
||||||
(LPARAM)(LPCSTR)wszLongDateFmt);
|
(LPARAM)szLongDateFmt);
|
||||||
|
|
||||||
/* Get setted format string size */
|
/* Get setted format string size */
|
||||||
nFmtStrSize = wcslen(wszLongDateFmt);
|
nFmtStrSize = _tcslen(szLongDateFmt);
|
||||||
|
|
||||||
/* Check date components */
|
/* Check date components */
|
||||||
for(nDateCompCount=0;nDateCompCount<nFmtStrSize;nDateCompCount++)
|
for (nDateCompCount = 0; nDateCompCount < nFmtStrSize; nDateCompCount++)
|
||||||
{
|
{
|
||||||
if(wszLongDateFmt[nDateCompCount]==L'\'')
|
if (szLongDateFmt[nDateCompCount] == _T('\''))
|
||||||
{
|
{
|
||||||
OpenApostFlg=!OpenApostFlg;
|
OpenApostFlg = !OpenApostFlg;
|
||||||
}
|
}
|
||||||
if(iswalnum(wszLongDateFmt[nDateCompCount]) &&
|
|
||||||
!isDateCompAl(wszLongDateFmt[nDateCompCount]) &&
|
if (_istalnum(szLongDateFmt[nDateCompCount]) &&
|
||||||
!OpenApostFlg)
|
!isDateCompAl(szLongDateFmt[nDateCompCount]) &&
|
||||||
|
!OpenApostFlg)
|
||||||
{
|
{
|
||||||
MessageBoxW(NULL,
|
MessageBox(NULL,
|
||||||
L"Entered long date format contain incorrect symbol",
|
_T("Entered long date format contain incorrect symbol"),
|
||||||
L"Error", MB_OK | MB_ICONERROR);
|
_T("Error"), MB_OK | MB_ICONERROR);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(OpenApostFlg)
|
if (OpenApostFlg)
|
||||||
{
|
{
|
||||||
MessageBoxW(NULL,
|
MessageBoxW(NULL,
|
||||||
L"Entered long date format contain incorrect symbol",
|
_T("Entered long date format contain incorrect symbol"),
|
||||||
L"Error", MB_OK | MB_ICONERROR);
|
_T("Error"), MB_OK | MB_ICONERROR);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Save short date format */
|
/* Save short date format */
|
||||||
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SLONGDATE, wszLongDateFmt);
|
SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SLONGDATE, szLongDateFmt);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Init short date separator control box */
|
/* Init short date separator control box */
|
||||||
VOID
|
static VOID
|
||||||
InitShortDateSepSamples(HWND hwndDlg)
|
InitShortDateSepSamples(HWND hwndDlg)
|
||||||
{
|
{
|
||||||
WCHAR ShortDateSepSamples[MAX_SHRT_DATE_SEPARATORS][MAX_SAMPLES_STR_SIZE]=
|
LPTSTR ShortDateSepSamples[MAX_SHRT_DATE_SEPARATORS] =
|
||||||
{
|
{
|
||||||
L".",
|
_T("."),
|
||||||
L"/",
|
_T("/"),
|
||||||
L"-"
|
_T("-")
|
||||||
};
|
};
|
||||||
|
TCHAR szShortDateSep[MAX_SAMPLES_STR_SIZE];
|
||||||
int nCBIndex;
|
INT nCBIndex;
|
||||||
int nRetCode;
|
INT nRetCode;
|
||||||
|
|
||||||
DWORD dwValueSize=MAX_SAMPLES_STR_SIZE*sizeof(WCHAR)+EOLN_SIZE;
|
|
||||||
WCHAR wszShortDateSep[MAX_SAMPLES_STR_SIZE];
|
|
||||||
|
|
||||||
/* Get current short date separator */
|
/* Get current short date separator */
|
||||||
GetLocaleInfoW(LOCALE_USER_DEFAULT,
|
GetLocaleInfo(LOCALE_USER_DEFAULT,
|
||||||
LOCALE_SDATE,
|
LOCALE_SDATE,
|
||||||
wszShortDateSep,
|
szShortDateSep,
|
||||||
dwValueSize);
|
MAX_SAMPLES_STR_SIZE);
|
||||||
|
|
||||||
/* Clear all box content */
|
/* Clear all box content */
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_SHRTDATESEP_COMBO),
|
SendMessage(GetDlgItem(hwndDlg, IDC_SHRTDATESEP_COMBO),
|
||||||
CB_RESETCONTENT,
|
CB_RESETCONTENT,
|
||||||
(WPARAM)0,
|
(WPARAM)0,
|
||||||
(LPARAM)0);
|
(LPARAM)0);
|
||||||
|
|
||||||
/* Create standart list of separators */
|
/* Create standart list of separators */
|
||||||
for(nCBIndex=0;nCBIndex<MAX_SHRT_DATE_SEPARATORS;nCBIndex++)
|
for (nCBIndex = 0; nCBIndex < MAX_SHRT_DATE_SEPARATORS; nCBIndex++)
|
||||||
{
|
{
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_SHRTDATESEP_COMBO),
|
SendMessageW(GetDlgItem(hwndDlg, IDC_SHRTDATESEP_COMBO),
|
||||||
CB_ADDSTRING,
|
CB_ADDSTRING,
|
||||||
|
@ -281,22 +279,22 @@ InitShortDateSepSamples(HWND hwndDlg)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set current item to value from registry */
|
/* Set current item to value from registry */
|
||||||
nRetCode = SendMessageW(GetDlgItem(hwndDlg, IDC_SHRTDATESEP_COMBO),
|
nRetCode = SendMessage(GetDlgItem(hwndDlg, IDC_SHRTDATESEP_COMBO),
|
||||||
CB_SELECTSTRING,
|
CB_SELECTSTRING,
|
||||||
-1,
|
-1,
|
||||||
(LPARAM)(LPCSTR)wszShortDateSep);
|
(LPARAM)szShortDateSep);
|
||||||
|
|
||||||
/* if is not success, add new value to list and select them */
|
/* if is not success, add new value to list and select them */
|
||||||
if(nRetCode == CB_ERR)
|
if (nRetCode == CB_ERR)
|
||||||
{
|
{
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_SHRTDATESEP_COMBO),
|
SendMessage(GetDlgItem(hwndDlg, IDC_SHRTDATESEP_COMBO),
|
||||||
CB_ADDSTRING,
|
CB_ADDSTRING,
|
||||||
MAX_SHRT_DATE_SEPARATORS+1,
|
MAX_SHRT_DATE_SEPARATORS+1,
|
||||||
(LPARAM)wszShortDateSep);
|
(LPARAM)szShortDateSep);
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_SHRTDATESEP_COMBO),
|
SendMessageW(GetDlgItem(hwndDlg, IDC_SHRTDATESEP_COMBO),
|
||||||
CB_SELECTSTRING,
|
CB_SELECTSTRING,
|
||||||
-1,
|
-1,
|
||||||
(LPARAM)(LPCSTR)wszShortDateSep);
|
(LPARAM)szShortDateSep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -304,128 +302,124 @@ InitShortDateSepSamples(HWND hwndDlg)
|
||||||
VOID
|
VOID
|
||||||
InitShortDateCB(HWND hwndDlg)
|
InitShortDateCB(HWND hwndDlg)
|
||||||
{
|
{
|
||||||
WCHAR ShortDateFmtSamples[MAX_SHORT_FMT_SAMPLES][MAX_SAMPLES_STR_SIZE]=
|
LPTSTR ShortDateFmtSamples[MAX_SHORT_FMT_SAMPLES] =
|
||||||
{
|
{
|
||||||
L"dd.MM.yyyy",
|
_T("dd.MM.yyyy"),
|
||||||
L"dd.MM.yy",
|
_T("dd.MM.yy"),
|
||||||
L"d.M.yy",
|
_T("d.M.yy"),
|
||||||
L"dd/MM/yy",
|
_T("dd/MM/yy"),
|
||||||
L"yyyy-MM-dd"
|
_T("yyyy-MM-dd")
|
||||||
};
|
};
|
||||||
|
TCHAR szShortDateFmt[MAX_SAMPLES_STR_SIZE];
|
||||||
int nCBIndex;
|
INT nCBIndex;
|
||||||
int nRetCode;
|
INT nRetCode;
|
||||||
|
|
||||||
DWORD dwValueSize=MAX_SAMPLES_STR_SIZE*sizeof(WCHAR)+EOLN_SIZE;
|
|
||||||
WCHAR wszShortDateFmt[MAX_SAMPLES_STR_SIZE];
|
|
||||||
|
|
||||||
/* Get current short date format */
|
/* Get current short date format */
|
||||||
GetLocaleInfoW(LOCALE_USER_DEFAULT,
|
GetLocaleInfo(LOCALE_USER_DEFAULT,
|
||||||
LOCALE_SSHORTDATE,
|
LOCALE_SSHORTDATE,
|
||||||
wszShortDateFmt,
|
szShortDateFmt,
|
||||||
dwValueSize);
|
MAX_SAMPLES_STR_SIZE);
|
||||||
|
|
||||||
/* Clear all box content */
|
/* Clear all box content */
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_SHRTDATEFMT_COMBO),
|
SendMessage(GetDlgItem(hwndDlg, IDC_SHRTDATEFMT_COMBO),
|
||||||
CB_RESETCONTENT,
|
CB_RESETCONTENT,
|
||||||
(WPARAM)0,
|
(WPARAM)0,
|
||||||
(LPARAM)0);
|
(LPARAM)0);
|
||||||
|
|
||||||
/* Create standart list of date formats */
|
/* Create standart list of date formats */
|
||||||
for(nCBIndex=0;nCBIndex<MAX_SHORT_FMT_SAMPLES;nCBIndex++)
|
for (nCBIndex = 0; nCBIndex < MAX_SHORT_FMT_SAMPLES; nCBIndex++)
|
||||||
{
|
{
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_SHRTDATEFMT_COMBO),
|
SendMessage(GetDlgItem(hwndDlg, IDC_SHRTDATEFMT_COMBO),
|
||||||
CB_ADDSTRING,
|
CB_ADDSTRING,
|
||||||
nCBIndex,
|
nCBIndex,
|
||||||
(LPARAM)ShortDateFmtSamples[nCBIndex]);
|
(LPARAM)ShortDateFmtSamples[nCBIndex]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set current item to value from registry */
|
/* Set current item to value from registry */
|
||||||
nRetCode = SendMessageW(GetDlgItem(hwndDlg, IDC_SHRTDATEFMT_COMBO),
|
nRetCode = SendMessage(GetDlgItem(hwndDlg, IDC_SHRTDATEFMT_COMBO),
|
||||||
CB_SELECTSTRING,
|
CB_SELECTSTRING,
|
||||||
-1,
|
-1,
|
||||||
(LPARAM)(LPCSTR)wszShortDateFmt);
|
(LPARAM)szShortDateFmt);
|
||||||
|
|
||||||
/* if is not success, add new value to list and select them */
|
/* if is not success, add new value to list and select them */
|
||||||
if(nRetCode == CB_ERR)
|
if (nRetCode == CB_ERR)
|
||||||
{
|
{
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_SHRTDATEFMT_COMBO),
|
SendMessage(GetDlgItem(hwndDlg, IDC_SHRTDATEFMT_COMBO),
|
||||||
CB_ADDSTRING,
|
CB_ADDSTRING,
|
||||||
MAX_SHORT_FMT_SAMPLES+1,
|
MAX_SHORT_FMT_SAMPLES+1,
|
||||||
(LPARAM)wszShortDateFmt);
|
(LPARAM)szShortDateFmt);
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_SHRTDATEFMT_COMBO),
|
SendMessage(GetDlgItem(hwndDlg, IDC_SHRTDATEFMT_COMBO),
|
||||||
CB_SELECTSTRING,
|
CB_SELECTSTRING,
|
||||||
-1,
|
-1,
|
||||||
(LPARAM)(LPCSTR)wszShortDateFmt);
|
(LPARAM)szShortDateFmt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Init long date control box */
|
/* Init long date control box */
|
||||||
VOID
|
static VOID
|
||||||
InitLongDateCB(HWND hwndDlg)
|
InitLongDateCB(HWND hwndDlg)
|
||||||
{
|
{
|
||||||
/* Where this data stored? */
|
/* Where this data stored? */
|
||||||
WCHAR LongDateFmtSamples[MAX_LONG_FMT_SAMPLES][MAX_SAMPLES_STR_SIZE]=
|
LPTSTR LongDateFmtSamples[MAX_LONG_FMT_SAMPLES] =
|
||||||
{
|
{
|
||||||
L"d MMMM yyyy 'y.'",
|
_T("d MMMM yyyy 'y.'"),
|
||||||
L"dd MMMM yyyy 'y.'"
|
_T("dd MMMM yyyy 'y.'")
|
||||||
};
|
};
|
||||||
|
TCHAR szLongDateFmt[MAX_SAMPLES_STR_SIZE];
|
||||||
int nCBIndex;
|
INT nCBIndex;
|
||||||
int nRetCode;
|
INT nRetCode;
|
||||||
|
|
||||||
DWORD dwValueSize=MAX_SAMPLES_STR_SIZE*sizeof(WCHAR)+EOLN_SIZE;
|
|
||||||
WCHAR wszLongDateFmt[MAX_SAMPLES_STR_SIZE];
|
|
||||||
|
|
||||||
/* Get current long date format */
|
/* Get current long date format */
|
||||||
GetLocaleInfoW(LOCALE_USER_DEFAULT,
|
GetLocaleInfo(LOCALE_USER_DEFAULT,
|
||||||
LOCALE_SLONGDATE,
|
LOCALE_SLONGDATE,
|
||||||
wszLongDateFmt,
|
szLongDateFmt,
|
||||||
dwValueSize);
|
MAX_SAMPLES_STR_SIZE);
|
||||||
|
|
||||||
/* Clear all box content */
|
/* Clear all box content */
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_LONGDATEFMT_COMBO),
|
SendMessage(GetDlgItem(hwndDlg, IDC_LONGDATEFMT_COMBO),
|
||||||
CB_RESETCONTENT,
|
CB_RESETCONTENT,
|
||||||
(WPARAM)0,
|
(WPARAM)0,
|
||||||
(LPARAM)0);
|
(LPARAM)0);
|
||||||
|
|
||||||
/* Create standart list of date formats */
|
/* Create standart list of date formats */
|
||||||
for(nCBIndex=0;nCBIndex<MAX_LONG_FMT_SAMPLES;nCBIndex++)
|
for (nCBIndex = 0; nCBIndex < MAX_LONG_FMT_SAMPLES; nCBIndex++)
|
||||||
{
|
{
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_LONGDATEFMT_COMBO),
|
SendMessage(GetDlgItem(hwndDlg, IDC_LONGDATEFMT_COMBO),
|
||||||
CB_ADDSTRING,
|
CB_ADDSTRING,
|
||||||
nCBIndex,
|
nCBIndex,
|
||||||
(LPARAM)LongDateFmtSamples[nCBIndex]);
|
(LPARAM)LongDateFmtSamples[nCBIndex]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set current item to value from registry */
|
/* Set current item to value from registry */
|
||||||
nRetCode = SendMessageW(GetDlgItem(hwndDlg, IDC_LONGDATEFMT_COMBO),
|
nRetCode = SendMessage(GetDlgItem(hwndDlg, IDC_LONGDATEFMT_COMBO),
|
||||||
CB_SELECTSTRING,
|
CB_SELECTSTRING,
|
||||||
-1,
|
-1,
|
||||||
(LPARAM)(LPCSTR)wszLongDateFmt);
|
(LPARAM)szLongDateFmt);
|
||||||
|
|
||||||
/* if is not success, add new value to list and select them */
|
/* if is not success, add new value to list and select them */
|
||||||
if(nRetCode == CB_ERR)
|
if (nRetCode == CB_ERR)
|
||||||
{
|
{
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_LONGDATEFMT_COMBO),
|
SendMessage(GetDlgItem(hwndDlg, IDC_LONGDATEFMT_COMBO),
|
||||||
CB_ADDSTRING,
|
CB_ADDSTRING,
|
||||||
MAX_LONG_FMT_SAMPLES+1,
|
MAX_LONG_FMT_SAMPLES+1,
|
||||||
(LPARAM)wszLongDateFmt);
|
(LPARAM)szLongDateFmt);
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_LONGDATEFMT_COMBO),
|
SendMessage(GetDlgItem(hwndDlg, IDC_LONGDATEFMT_COMBO),
|
||||||
CB_SELECTSTRING,
|
CB_SELECTSTRING,
|
||||||
-1,
|
-1,
|
||||||
(LPARAM)(LPCSTR)wszLongDateFmt);
|
(LPARAM)szLongDateFmt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set up max date value to registry */
|
/* Set up max date value to registry */
|
||||||
VOID
|
static VOID
|
||||||
SetMaxDate(HWND hwndDlg)
|
SetMaxDate(HWND hwndDlg)
|
||||||
{
|
{
|
||||||
const HWND hWndYearSpin = GetDlgItem(hwndDlg, IDC_SCR_MAX_YEAR);
|
TCHAR szMaxDateVal[YEAR_STR_MAX_SIZE];
|
||||||
WCHAR wszMaxDateVal[YEAR_STR_MAX_SIZE];
|
HWND hWndYearSpin;
|
||||||
INT nSpinVal;
|
INT nSpinVal;
|
||||||
|
|
||||||
|
hWndYearSpin = GetDlgItem(hwndDlg, IDC_SCR_MAX_YEAR);
|
||||||
|
|
||||||
/* Get spin value */
|
/* Get spin value */
|
||||||
nSpinVal=LOWORD(SendMessage(hWndYearSpin,
|
nSpinVal=LOWORD(SendMessage(hWndYearSpin,
|
||||||
UDM_GETPOS,
|
UDM_GETPOS,
|
||||||
|
@ -433,131 +427,131 @@ SetMaxDate(HWND hwndDlg)
|
||||||
0));
|
0));
|
||||||
|
|
||||||
/* convert to wide char */
|
/* convert to wide char */
|
||||||
_itow(nSpinVal,wszMaxDateVal,DECIMAL_RADIX);
|
_itot(nSpinVal, szMaxDateVal, DECIMAL_RADIX);
|
||||||
|
|
||||||
/* Save max date value */
|
/* Save max date value */
|
||||||
SetCalendarInfoW(LOCALE_USER_DEFAULT,
|
SetCalendarInfo(LOCALE_USER_DEFAULT,
|
||||||
CAL_GREGORIAN,
|
CAL_GREGORIAN,
|
||||||
48 , /* CAL_ITWODIGITYEARMAX */
|
48 , /* CAL_ITWODIGITYEARMAX */
|
||||||
(LPCWSTR)&wszMaxDateVal);
|
(LPCTSTR)&szMaxDateVal);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get max date value from registry set */
|
/* Get max date value from registry set */
|
||||||
INT
|
static INT
|
||||||
GetMaxDate()
|
GetMaxDate(VOID)
|
||||||
{
|
{
|
||||||
int nMaxDateVal;
|
INT nMaxDateVal;
|
||||||
|
|
||||||
GetCalendarInfoW(LOCALE_USER_DEFAULT,
|
GetCalendarInfo(LOCALE_USER_DEFAULT,
|
||||||
CAL_GREGORIAN,
|
CAL_GREGORIAN,
|
||||||
CAL_ITWODIGITYEARMAX | CAL_RETURN_NUMBER,
|
CAL_ITWODIGITYEARMAX | CAL_RETURN_NUMBER,
|
||||||
NULL,
|
NULL,
|
||||||
0, /* ret type - number */
|
0, /* ret type - number */
|
||||||
(LPDWORD)&nMaxDateVal);
|
(LPDWORD)&nMaxDateVal);
|
||||||
|
|
||||||
return nMaxDateVal;
|
return nMaxDateVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set's MIN data edit control value to MAX-99 */
|
/* Set's MIN data edit control value to MAX-99 */
|
||||||
static
|
static VOID
|
||||||
VOID
|
|
||||||
SetMinData(HWND hwndDlg)
|
SetMinData(HWND hwndDlg)
|
||||||
{
|
{
|
||||||
WCHAR OutBuffer[YEAR_STR_MAX_SIZE];
|
TCHAR OutBuffer[YEAR_STR_MAX_SIZE];
|
||||||
const HWND hWndYearSpin = GetDlgItem(hwndDlg, IDC_SCR_MAX_YEAR);
|
HWND hWndYearSpin;
|
||||||
|
INT nSpinVal;
|
||||||
|
|
||||||
|
hWndYearSpin = GetDlgItem(hwndDlg, IDC_SCR_MAX_YEAR);
|
||||||
|
|
||||||
/* Get spin value */
|
/* Get spin value */
|
||||||
INT nSpinVal=LOWORD(SendMessage(hWndYearSpin,
|
nSpinVal = LOWORD(SendMessage(hWndYearSpin,
|
||||||
UDM_GETPOS,
|
UDM_GETPOS,
|
||||||
0,
|
0,
|
||||||
0));
|
0));
|
||||||
|
|
||||||
/* Set min year value */
|
/* Set min year value */
|
||||||
wsprintf(OutBuffer, L"%d", (DWORD)nSpinVal-YEAR_DIFF);
|
wsprintf(OutBuffer, _T("%d"), (DWORD)nSpinVal - YEAR_DIFF);
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_FIRSTYEAR_EDIT),
|
SendMessage(GetDlgItem(hwndDlg, IDC_FIRSTYEAR_EDIT),
|
||||||
WM_SETTEXT,
|
WM_SETTEXT,
|
||||||
0,
|
0,
|
||||||
(LPARAM)OutBuffer);
|
(LPARAM)OutBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Init spin control */
|
/* Init spin control */
|
||||||
static
|
static VOID
|
||||||
VOID
|
|
||||||
InitMinMaxDateSpin(HWND hwndDlg)
|
InitMinMaxDateSpin(HWND hwndDlg)
|
||||||
{
|
{
|
||||||
WCHAR OutBuffer[YEAR_STR_MAX_SIZE];
|
TCHAR OutBuffer[YEAR_STR_MAX_SIZE];
|
||||||
const HWND hWndYearSpin = GetDlgItem(hwndDlg, IDC_SCR_MAX_YEAR);
|
HWND hWndYearSpin;
|
||||||
|
|
||||||
|
hWndYearSpin = GetDlgItem(hwndDlg, IDC_SCR_MAX_YEAR);
|
||||||
|
|
||||||
/* Init max date value */
|
/* Init max date value */
|
||||||
wsprintf(OutBuffer, L"%04d", (DWORD)GetMaxDate());
|
wsprintf(OutBuffer, _T("%04d"), (DWORD)GetMaxDate());
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_SECONDYEAR_EDIT),
|
SendMessage(GetDlgItem(hwndDlg, IDC_SECONDYEAR_EDIT),
|
||||||
WM_SETTEXT,
|
WM_SETTEXT,
|
||||||
0,
|
0,
|
||||||
(LPARAM)OutBuffer);
|
(LPARAM)OutBuffer);
|
||||||
|
|
||||||
/* Init min date value */
|
/* Init min date value */
|
||||||
wsprintf(OutBuffer, L"%04d", (DWORD)GetMaxDate()-YEAR_DIFF);
|
wsprintf(OutBuffer, _T("%04d"), (DWORD)GetMaxDate()-YEAR_DIFF);
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_FIRSTYEAR_EDIT),
|
SendMessage(GetDlgItem(hwndDlg, IDC_FIRSTYEAR_EDIT),
|
||||||
WM_SETTEXT,
|
WM_SETTEXT,
|
||||||
0,
|
0,
|
||||||
(LPARAM)OutBuffer);
|
(LPARAM)OutBuffer);
|
||||||
|
|
||||||
/* Init updown control */
|
/* Init updown control */
|
||||||
/* Set bounds */
|
/* Set bounds */
|
||||||
SendMessageW(hWndYearSpin,
|
SendMessage(hWndYearSpin,
|
||||||
UDM_SETRANGE,
|
UDM_SETRANGE,
|
||||||
0,
|
0,
|
||||||
MAKELONG(MAX_YEAR,YEAR_DIFF));
|
MAKELONG(MAX_YEAR,YEAR_DIFF));
|
||||||
|
|
||||||
/* Set current value */
|
/* Set current value */
|
||||||
SendMessageW(hWndYearSpin,
|
SendMessage(hWndYearSpin,
|
||||||
UDM_SETPOS,
|
UDM_SETPOS,
|
||||||
0,
|
0,
|
||||||
MAKELONG(GetMaxDate(),0));
|
MAKELONG(GetMaxDate(),0));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Update all date locale samples */
|
/* Update all date locale samples */
|
||||||
static
|
static VOID
|
||||||
VOID
|
|
||||||
UpdateDateLocaleSamples(HWND hwndDlg,
|
UpdateDateLocaleSamples(HWND hwndDlg,
|
||||||
LCID lcidLocale)
|
LCID lcidLocale)
|
||||||
{
|
{
|
||||||
WCHAR OutBuffer[MAX_FMT_SIZE];
|
TCHAR OutBuffer[MAX_FMT_SIZE];
|
||||||
|
|
||||||
/* Get short date format sample */
|
/* Get short date format sample */
|
||||||
GetDateFormatW(lcidLocale, DATE_SHORTDATE, NULL, NULL, OutBuffer,
|
GetDateFormat(lcidLocale, DATE_SHORTDATE, NULL, NULL, OutBuffer,
|
||||||
MAX_FMT_SIZE);
|
MAX_FMT_SIZE);
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_SHRTDATESAMPLE_EDIT), WM_SETTEXT,
|
SendMessage(GetDlgItem(hwndDlg, IDC_SHRTDATESAMPLE_EDIT), WM_SETTEXT,
|
||||||
0, (LPARAM)OutBuffer);
|
0, (LPARAM)OutBuffer);
|
||||||
|
|
||||||
/* Get long date sample */
|
/* Get long date sample */
|
||||||
GetDateFormatW(lcidLocale, DATE_LONGDATE, NULL, NULL, OutBuffer,
|
GetDateFormat(lcidLocale, DATE_LONGDATE, NULL, NULL, OutBuffer,
|
||||||
MAX_FMT_SIZE);
|
MAX_FMT_SIZE);
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_LONGDATESAMPLE_EDIT),
|
SendMessage(GetDlgItem(hwndDlg, IDC_LONGDATESAMPLE_EDIT),
|
||||||
WM_SETTEXT, 0, (LPARAM)OutBuffer);
|
WM_SETTEXT, 0, (LPARAM)OutBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Property page dialog callback */
|
/* Property page dialog callback */
|
||||||
INT_PTR CALLBACK
|
INT_PTR CALLBACK
|
||||||
DatePageProc(HWND hwndDlg,
|
DatePageProc(HWND hwndDlg,
|
||||||
UINT uMsg,
|
UINT uMsg,
|
||||||
WPARAM wParam,
|
WPARAM wParam,
|
||||||
LPARAM lParam)
|
LPARAM lParam)
|
||||||
{
|
{
|
||||||
switch(uMsg)
|
switch (uMsg)
|
||||||
{
|
|
||||||
case WM_INITDIALOG:
|
|
||||||
{
|
{
|
||||||
InitMinMaxDateSpin(hwndDlg);
|
case WM_INITDIALOG:
|
||||||
UpdateDateLocaleSamples(hwndDlg, LOCALE_USER_DEFAULT);
|
InitMinMaxDateSpin(hwndDlg);
|
||||||
InitShortDateCB(hwndDlg);
|
UpdateDateLocaleSamples(hwndDlg, LOCALE_USER_DEFAULT);
|
||||||
InitLongDateCB(hwndDlg);
|
InitShortDateCB(hwndDlg);
|
||||||
InitShortDateSepSamples(hwndDlg);
|
InitLongDateCB(hwndDlg);
|
||||||
/* TODO: Add other calendar types */
|
InitShortDateSepSamples(hwndDlg);
|
||||||
}
|
/* TODO: Add other calendar types */
|
||||||
break;
|
break;
|
||||||
case WM_COMMAND:
|
|
||||||
|
case WM_COMMAND:
|
||||||
{
|
{
|
||||||
switch (LOWORD(wParam))
|
switch (LOWORD(wParam))
|
||||||
{
|
{
|
||||||
|
@ -608,8 +602,9 @@ DatePageProc(HWND hwndDlg,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return FALSE;
|
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -26,106 +26,104 @@
|
||||||
* Aleksey Bragin
|
* Aleksey Bragin
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define WINVER 0x0501
|
|
||||||
#define SAMPLE_NUMBER L"123456789"
|
|
||||||
#define NO_FLAG 0
|
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <commctrl.h>
|
#include <commctrl.h>
|
||||||
#include <cpl.h>
|
#include <cpl.h>
|
||||||
|
#include <tchar.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "intl.h"
|
#include "intl.h"
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
|
|
||||||
|
#define SAMPLE_NUMBER _T("123456789")
|
||||||
|
#define NO_FLAG 0
|
||||||
|
|
||||||
HWND hList;
|
HWND hList;
|
||||||
HWND hLocaleList, hGeoList;
|
HWND hLocaleList, hGeoList;
|
||||||
|
|
||||||
BOOL CALLBACK LocalesEnumProc(
|
BOOL CALLBACK
|
||||||
LPTSTR lpLocale // locale id
|
LocalesEnumProc(LPTSTR lpLocale)
|
||||||
)
|
|
||||||
{
|
{
|
||||||
LCID lcid;
|
LCID lcid;
|
||||||
TCHAR lang[255];
|
TCHAR lang[255];
|
||||||
int index;
|
INT index;
|
||||||
|
|
||||||
//swscanf(lpLocale, L"%lx", &lcid); // maybe use wcstoul?
|
//swscanf(lpLocale, L"%lx", &lcid); // maybe use wcstoul?
|
||||||
lcid = wcstoul(lpLocale, NULL, 16);
|
lcid = _tcstoul(lpLocale, NULL, 16);
|
||||||
|
|
||||||
GetLocaleInfo(lcid, LOCALE_SLANGUAGE, lang, sizeof(lang));
|
GetLocaleInfo(lcid, LOCALE_SLANGUAGE, lang, sizeof(lang));
|
||||||
|
|
||||||
index = SendMessageW(hList,
|
index = SendMessage(hList,
|
||||||
CB_ADDSTRING,
|
CB_ADDSTRING,
|
||||||
0,
|
0,
|
||||||
(LPARAM)lang);
|
(LPARAM)lang);
|
||||||
|
|
||||||
SendMessageW(hList,
|
SendMessage(hList,
|
||||||
CB_SETITEMDATA,
|
CB_SETITEMDATA,
|
||||||
index,
|
index,
|
||||||
(LPARAM)lcid);
|
(LPARAM)lcid);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Update all locale samples */
|
/* Update all locale samples */
|
||||||
static
|
static VOID
|
||||||
VOID
|
|
||||||
UpdateLocaleSample(HWND hwndDlg, LCID lcidLocale)
|
UpdateLocaleSample(HWND hwndDlg, LCID lcidLocale)
|
||||||
{
|
{
|
||||||
WCHAR OutBuffer[MAX_FMT_SIZE];
|
TCHAR OutBuffer[MAX_FMT_SIZE];
|
||||||
|
|
||||||
/* Get number format sample */
|
/* Get number format sample */
|
||||||
GetNumberFormatW(lcidLocale, NO_FLAG, SAMPLE_NUMBER, NULL, OutBuffer,
|
GetNumberFormat(lcidLocale, NO_FLAG, SAMPLE_NUMBER, NULL, OutBuffer,
|
||||||
MAX_FMT_SIZE);
|
MAX_FMT_SIZE);
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_NUMSAMPLE_EDIT),
|
SendMessage(GetDlgItem(hwndDlg, IDC_NUMSAMPLE_EDIT),
|
||||||
WM_SETTEXT, 0, (LPARAM)OutBuffer);
|
WM_SETTEXT, 0, (LPARAM)OutBuffer);
|
||||||
|
|
||||||
/* Get monetary format sample */
|
/* Get monetary format sample */
|
||||||
GetCurrencyFormatW(lcidLocale, LOCALE_USE_CP_ACP, SAMPLE_NUMBER, NULL,
|
GetCurrencyFormat(lcidLocale, LOCALE_USE_CP_ACP, SAMPLE_NUMBER, NULL,
|
||||||
OutBuffer, MAX_FMT_SIZE);
|
OutBuffer, MAX_FMT_SIZE);
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_MONEYSAMPLE_EDIT),
|
SendMessage(GetDlgItem(hwndDlg, IDC_MONEYSAMPLE_EDIT),
|
||||||
WM_SETTEXT, 0, (LPARAM)OutBuffer);
|
WM_SETTEXT, 0, (LPARAM)OutBuffer);
|
||||||
|
|
||||||
/* Get time format sample */
|
/* Get time format sample */
|
||||||
GetTimeFormatW(lcidLocale, NO_FLAG, NULL, NULL, OutBuffer, MAX_FMT_SIZE);
|
GetTimeFormat(lcidLocale, NO_FLAG, NULL, NULL, OutBuffer, MAX_FMT_SIZE);
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMESAMPLE_EDIT),
|
SendMessage(GetDlgItem(hwndDlg, IDC_TIMESAMPLE_EDIT),
|
||||||
WM_SETTEXT,
|
WM_SETTEXT,
|
||||||
0,
|
0,
|
||||||
(LPARAM)OutBuffer);
|
(LPARAM)OutBuffer);
|
||||||
|
|
||||||
/* Get short date format sample */
|
/* Get short date format sample */
|
||||||
GetDateFormatW(lcidLocale, DATE_SHORTDATE, NULL, NULL, OutBuffer,
|
GetDateFormat(lcidLocale, DATE_SHORTDATE, NULL, NULL, OutBuffer,
|
||||||
MAX_FMT_SIZE);
|
MAX_FMT_SIZE);
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_SHORTTIMESAMPLE_EDIT), WM_SETTEXT,
|
SendMessage(GetDlgItem(hwndDlg, IDC_SHORTTIMESAMPLE_EDIT), WM_SETTEXT,
|
||||||
0, (LPARAM)OutBuffer);
|
0, (LPARAM)OutBuffer);
|
||||||
|
|
||||||
/* Get long date sample */
|
/* Get long date sample */
|
||||||
GetDateFormatW(lcidLocale, DATE_LONGDATE, NULL, NULL, OutBuffer,
|
GetDateFormat(lcidLocale, DATE_LONGDATE, NULL, NULL, OutBuffer,
|
||||||
MAX_FMT_SIZE);
|
MAX_FMT_SIZE);
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_FULLTIMESAMPLE_EDIT),
|
SendMessage(GetDlgItem(hwndDlg, IDC_FULLTIMESAMPLE_EDIT),
|
||||||
WM_SETTEXT, 0, (LPARAM)OutBuffer);
|
WM_SETTEXT, 0, (LPARAM)OutBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
static VOID
|
static VOID
|
||||||
CreateLanguagesList(HWND hwnd)
|
CreateLanguagesList(HWND hwnd)
|
||||||
{
|
{
|
||||||
TCHAR langSel[255];
|
TCHAR langSel[255];
|
||||||
|
|
||||||
hList = hwnd;
|
hList = hwnd;
|
||||||
EnumSystemLocalesW(LocalesEnumProc, LCID_SUPPORTED);
|
EnumSystemLocales(LocalesEnumProc, LCID_SUPPORTED);
|
||||||
|
|
||||||
// Select current locale
|
// Select current locale
|
||||||
GetLocaleInfo(GetUserDefaultLCID(), LOCALE_SLANGUAGE, langSel, sizeof(langSel)); // or should it be System and not user?
|
GetLocaleInfo(GetUserDefaultLCID(), LOCALE_SLANGUAGE, langSel, sizeof(langSel)); // or should it be System and not user?
|
||||||
|
|
||||||
SendMessageW(hList,
|
SendMessage(hList,
|
||||||
CB_SELECTSTRING,
|
CB_SELECTSTRING,
|
||||||
-1,
|
-1,
|
||||||
(LPARAM)langSel);
|
(LPARAM)langSel);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sets new locale
|
// Sets new locale
|
||||||
void SetNewLocale(LCID lcid)
|
VOID
|
||||||
|
SetNewLocale(LCID lcid)
|
||||||
{
|
{
|
||||||
// HKCU\\Control Panel\\International\\Locale = 0409 (type=0)
|
// HKCU\\Control Panel\\International\\Locale = 0409 (type=0)
|
||||||
// HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","Default",0x00000000,"0409" (type=0)
|
// HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","Default",0x00000000,"0409" (type=0)
|
||||||
|
@ -137,111 +135,113 @@ void SetNewLocale(LCID lcid)
|
||||||
DWORD ret;
|
DWORD ret;
|
||||||
TCHAR value[9];
|
TCHAR value[9];
|
||||||
DWORD valuesize;
|
DWORD valuesize;
|
||||||
WCHAR ACPPage[9];
|
TCHAR ACPPage[9];
|
||||||
WCHAR OEMPage[9];
|
TCHAR OEMPage[9];
|
||||||
|
|
||||||
ret = GetLocaleInfoW(MAKELCID(lcid, SORT_DEFAULT), LOCALE_IDEFAULTCODEPAGE, (WORD*)OEMPage, sizeof(OEMPage));
|
ret = GetLocaleInfo(MAKELCID(lcid, SORT_DEFAULT), LOCALE_IDEFAULTCODEPAGE, (WORD*)OEMPage, sizeof(OEMPage));
|
||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
{
|
{
|
||||||
MessageBoxW(NULL, L"Problem reading OEM code page", L"Big Problem", MB_OK);
|
MessageBox(NULL, _T("Problem reading OEM code page"), _T("Big Problem"), MB_OK);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
GetLocaleInfoW(MAKELCID(lcid, SORT_DEFAULT), LOCALE_IDEFAULTANSICODEPAGE, (WORD*)ACPPage, sizeof(ACPPage));
|
GetLocaleInfo(MAKELCID(lcid, SORT_DEFAULT), LOCALE_IDEFAULTANSICODEPAGE, (WORD*)ACPPage, sizeof(ACPPage));
|
||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
{
|
{
|
||||||
MessageBoxW(NULL, L"Problem reading ANSI code page", L"Big Problem", MB_OK);
|
MessageBox(NULL, _T("Problem reading ANSI code page"), _T("Big Problem"), MB_OK);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = RegOpenKeyW(HKEY_CURRENT_USER, L"Control Panel\\International", &localeKey);
|
ret = RegOpenKey(HKEY_CURRENT_USER, _T("Control Panel\\International"), &localeKey);
|
||||||
|
|
||||||
if (ret != ERROR_SUCCESS)
|
if (ret != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
// some serious error
|
// some serious error
|
||||||
MessageBoxW(NULL, L"Problem opening HKCU\\Control Panel\\International key", L"Big Problem", MB_OK);
|
MessageBox(NULL, _T("Problem opening HKCU\\Control Panel\\International key"),
|
||||||
|
_T("Big Problem"), MB_OK);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
wsprintf(value, _T("%04X"), (DWORD)lcid);
|
||||||
|
valuesize = (_tcslen(value) + 1) * sizeof(TCHAR);
|
||||||
|
|
||||||
|
RegSetValueEx(localeKey, _T("Locale"), 0, REG_SZ, (LPBYTE)value, valuesize);
|
||||||
|
RegCloseKey(localeKey);
|
||||||
|
|
||||||
|
ret = RegOpenKey(HKEY_USERS, _T(".DEFAULT\\Control Panel\\International"), &localeKey);
|
||||||
|
if (ret != ERROR_SUCCESS)
|
||||||
|
{
|
||||||
|
// some serious error
|
||||||
|
MessageBox(NULL, _T("Problem opening HKU\\.DEFAULT\\Control Panel\\International key"),
|
||||||
|
_T("Big Problem"), MB_OK);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
wsprintf(value, L"%04X", (DWORD)lcid);
|
wsprintf(value, L"%04X", (DWORD)lcid);
|
||||||
valuesize = (wcslen(value) + 1) * sizeof(WCHAR);
|
valuesize = (_tcslen(value) + 1) * sizeof(TCHAR);
|
||||||
|
|
||||||
RegSetValueExW(localeKey, L"Locale", 0, REG_SZ, (BYTE *)value, valuesize);
|
RegSetValueEx(localeKey, _T("Locale"), 0, REG_SZ, (BYTE *)value, valuesize);
|
||||||
RegCloseKey(localeKey);
|
|
||||||
|
|
||||||
ret = RegOpenKeyW(HKEY_USERS, L".DEFAULT\\Control Panel\\International", &localeKey);
|
|
||||||
|
|
||||||
if (ret != ERROR_SUCCESS)
|
|
||||||
{
|
|
||||||
// some serious error
|
|
||||||
MessageBoxW(NULL, L"Problem opening HKU\\.DEFAULT\\Control Panel\\International key", L"Big Problem", MB_OK);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
wsprintf(value, L"%04X", (DWORD)lcid);
|
|
||||||
valuesize = (wcslen(value) + 1) * sizeof(WCHAR);
|
|
||||||
|
|
||||||
RegSetValueExW(localeKey, L"Locale", 0, REG_SZ, (BYTE *)value, valuesize);
|
|
||||||
RegCloseKey(localeKey);
|
RegCloseKey(localeKey);
|
||||||
|
|
||||||
// Set language
|
// Set language
|
||||||
ret = RegOpenKeyW(HKEY_LOCAL_MACHINE, L"SYSTEM\\CurrentControlSet\\Control\\NLS\\Language", &langKey);
|
ret = RegOpenKey(HKEY_LOCAL_MACHINE, _T("SYSTEM\\CurrentControlSet\\Control\\NLS\\Language"), &langKey);
|
||||||
|
|
||||||
if (ret != ERROR_SUCCESS)
|
if (ret != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
MessageBoxW(NULL, L"Problem opening HKLM\\SYSTEM\\CurrentControlSet\\Control\\NLS\\Language key", L"Big Problem", MB_OK);
|
MessageBoxW(NULL, _T("Problem opening HKLM\\SYSTEM\\CurrentControlSet\\Control\\NLS\\Language key"),
|
||||||
|
_T("Big Problem"), MB_OK);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
RegSetValueExW(langKey, L"Default", 0, REG_SZ, (BYTE *)value, valuesize );
|
RegSetValueEx(langKey, _T("Default"), 0, REG_SZ, (BYTE *)value, valuesize );
|
||||||
RegSetValueExW(langKey, L"InstallLanguage", 0, REG_SZ, (BYTE *)value, valuesize );
|
RegSetValueEx(langKey, _T("InstallLanguage"), 0, REG_SZ, (BYTE *)value, valuesize );
|
||||||
|
|
||||||
RegCloseKey(langKey);
|
RegCloseKey(langKey);
|
||||||
|
|
||||||
|
|
||||||
// Set language
|
/* Set language */
|
||||||
ret = RegOpenKeyW(HKEY_LOCAL_MACHINE, L"SYSTEM\\CurrentControlSet\\Control\\NLS\\CodePage", &langKey);
|
ret = RegOpenKey(HKEY_LOCAL_MACHINE, _T("SYSTEM\\CurrentControlSet\\Control\\NLS\\CodePage"), &langKey);
|
||||||
|
|
||||||
if (ret != ERROR_SUCCESS)
|
if (ret != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
MessageBoxW(NULL, L"Problem opening HKLM\\SYSTEM\\CurrentControlSet\\Control\\NLS\\CodePage key", L"Big Problem", MB_OK);
|
MessageBox(NULL, _T("Problem opening HKLM\\SYSTEM\\CurrentControlSet\\Control\\NLS\\CodePage key"),
|
||||||
|
_T("Big Problem"), MB_OK);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
RegSetValueExW(langKey, L"OEMCP", 0, REG_SZ, (BYTE *)OEMPage, (wcslen(OEMPage) +1 ) * sizeof(WCHAR) );
|
RegSetValueExW(langKey, _T("OEMCP"), 0, REG_SZ, (BYTE *)OEMPage, (_tcslen(OEMPage) +1 ) * sizeof(TCHAR));
|
||||||
RegSetValueExW(langKey, L"ACP", 0, REG_SZ, (BYTE *)ACPPage, (wcslen(ACPPage) +1 ) * sizeof(WCHAR) );
|
RegSetValueExW(langKey, _T("ACP"), 0, REG_SZ, (BYTE *)ACPPage, (_tcslen(ACPPage) +1 ) * sizeof(TCHAR));
|
||||||
|
|
||||||
RegCloseKey(langKey);
|
RegCloseKey(langKey);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Location enumerate procedure */
|
/* Location enumerate procedure */
|
||||||
|
#if 0
|
||||||
BOOL
|
BOOL
|
||||||
CALLBACK
|
CALLBACK
|
||||||
LocationsEnumProc(GEOID gId)
|
LocationsEnumProc(GEOID gId)
|
||||||
{
|
{
|
||||||
TCHAR loc[MAX_STR_SIZE];
|
TCHAR loc[MAX_STR_SIZE];
|
||||||
int index;
|
INT index;
|
||||||
|
|
||||||
GetGeoInfo(gId, GEO_FRIENDLYNAME, loc, MAX_FMT_SIZE, LANG_SYSTEM_DEFAULT);
|
GetGeoInfo(gId, GEO_FRIENDLYNAME, loc, MAX_FMT_SIZE, LANG_SYSTEM_DEFAULT);
|
||||||
index = (int) SendMessageW(hGeoList,
|
index = (INT)SendMessage(hGeoList,
|
||||||
CB_ADDSTRING,
|
CB_ADDSTRING,
|
||||||
0,
|
0,
|
||||||
(LPARAM)loc);
|
(LPARAM)loc);
|
||||||
|
|
||||||
SendMessageW(hGeoList,
|
SendMessage(hGeoList,
|
||||||
CB_SETITEMDATA,
|
CB_SETITEMDATA,
|
||||||
index,
|
index,
|
||||||
(LPARAM)gId);
|
(LPARAM)gId);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Enumerate all system locations identifiers */
|
/* Enumerate all system locations identifiers */
|
||||||
static
|
static
|
||||||
VOID
|
VOID
|
||||||
CreateLocationsList(HWND hWnd)
|
CreateLocationsList(HWND hWnd)
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
GEOID userGeoID;
|
GEOID userGeoID;
|
||||||
TCHAR loc[MAX_STR_SIZE];
|
TCHAR loc[MAX_STR_SIZE];
|
||||||
|
|
||||||
|
@ -257,16 +257,18 @@ CreateLocationsList(HWND hWnd)
|
||||||
MAX_FMT_SIZE,
|
MAX_FMT_SIZE,
|
||||||
LANG_SYSTEM_DEFAULT);
|
LANG_SYSTEM_DEFAULT);
|
||||||
|
|
||||||
SendMessageW(hGeoList,
|
SendMessage(hGeoList,
|
||||||
CB_SELECTSTRING,
|
CB_SELECTSTRING,
|
||||||
(WPARAM) -1,
|
(WPARAM) -1,
|
||||||
(LPARAM)loc);
|
(LPARAM)loc);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD
|
DWORD
|
||||||
VerifyUnattendLCID(HWND hwndDlg)
|
VerifyUnattendLCID(HWND hwndDlg)
|
||||||
{
|
{
|
||||||
LRESULT lCount, lIndex, lResult;
|
LRESULT lCount, lIndex, lResult;
|
||||||
|
|
||||||
lCount = SendMessage(hList, CB_GETCOUNT, (WPARAM)0, (LPARAM)0);
|
lCount = SendMessage(hList, CB_GETCOUNT, (WPARAM)0, (LPARAM)0);
|
||||||
if (lCount == CB_ERR)
|
if (lCount == CB_ERR)
|
||||||
{
|
{
|
||||||
|
@ -340,14 +342,14 @@ GeneralPageProc(HWND hwndDlg,
|
||||||
int iCurSel;
|
int iCurSel;
|
||||||
|
|
||||||
// Acquire new value
|
// Acquire new value
|
||||||
iCurSel = SendMessageW(hList,
|
iCurSel = SendMessage(hList,
|
||||||
CB_GETCURSEL,
|
CB_GETCURSEL,
|
||||||
0,
|
0,
|
||||||
0);
|
0);
|
||||||
if (iCurSel == CB_ERR)
|
if (iCurSel == CB_ERR)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
NewLcid = SendMessageW(hList,
|
NewLcid = SendMessage(hList,
|
||||||
CB_GETITEMDATA,
|
CB_GETITEMDATA,
|
||||||
iCurSel,
|
iCurSel,
|
||||||
0);
|
0);
|
||||||
|
@ -355,7 +357,6 @@ GeneralPageProc(HWND hwndDlg,
|
||||||
if (NewLcid == (LCID)CB_ERR)
|
if (NewLcid == (LCID)CB_ERR)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
// Actually set new locale
|
// Actually set new locale
|
||||||
SetNewLocale(NewLcid);
|
SetNewLocale(NewLcid);
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,16 +36,16 @@
|
||||||
/* Property page dialog callback */
|
/* Property page dialog callback */
|
||||||
INT_PTR CALLBACK
|
INT_PTR CALLBACK
|
||||||
InpLocalePageProc(HWND hwndDlg,
|
InpLocalePageProc(HWND hwndDlg,
|
||||||
UINT uMsg,
|
UINT uMsg,
|
||||||
WPARAM wParam,
|
WPARAM wParam,
|
||||||
LPARAM lParam)
|
LPARAM lParam)
|
||||||
{
|
{
|
||||||
switch(uMsg)
|
switch (uMsg)
|
||||||
{
|
{
|
||||||
case WM_INITDIALOG:
|
case WM_INITDIALOG:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -64,7 +64,7 @@ InitPropSheetPage(PROPSHEETPAGE *psp, WORD idDlg, DLGPROC DlgProc)
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL
|
BOOL
|
||||||
OpenSetupInf()
|
OpenSetupInf(VOID)
|
||||||
{
|
{
|
||||||
LPTSTR lpCmdLine;
|
LPTSTR lpCmdLine;
|
||||||
LPTSTR lpSwitch;
|
LPTSTR lpSwitch;
|
||||||
|
@ -101,7 +101,7 @@ OpenSetupInf()
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
ParseSetupInf()
|
ParseSetupInf(VOID)
|
||||||
{
|
{
|
||||||
INFCONTEXT InfContext;
|
INFCONTEXT InfContext;
|
||||||
TCHAR szBuffer[30];
|
TCHAR szBuffer[30];
|
||||||
|
|
|
@ -82,11 +82,11 @@ TimePageProc(HWND hwndDlg,
|
||||||
void SetNewLocale(LCID lcid);
|
void SetNewLocale(LCID lcid);
|
||||||
|
|
||||||
/* misc.c */
|
/* misc.c */
|
||||||
WCHAR*
|
LPTSTR
|
||||||
InsSpacesFmt(const WCHAR *wszSourceStr, const WCHAR *wszFmtStr);
|
InsSpacesFmt(LPCTSTR szSourceStr, LPCTSTR szFmtStr);
|
||||||
|
|
||||||
WCHAR*
|
LPTSTR
|
||||||
ReplaceSubStr(const WCHAR *wszSourceStr, const WCHAR *wszStrToReplace, const WCHAR *wszTempl);
|
ReplaceSubStr(LPCTSTR szSourceStr, LPCTSTR szStrToReplace, LPCTSTR szTempl);
|
||||||
|
|
||||||
LONG
|
LONG
|
||||||
APIENTRY
|
APIENTRY
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
<module name="intl" type="win32dll" extension=".cpl" baseaddress="${BASEADDRESS_INTL}" installbase="system32" installname="intl.cpl">
|
<module name="intl" type="win32dll" extension=".cpl" baseaddress="${BASEADDRESS_INTL}" installbase="system32" installname="intl.cpl" unicode="yes">
|
||||||
<importlibrary definition="intl.def" />
|
<importlibrary definition="intl.def" />
|
||||||
<include base="intl">.</include>
|
<include base="intl">.</include>
|
||||||
<define name="UNICODE" />
|
|
||||||
<define name="_UNICODE" />
|
|
||||||
<define name="__REACTOS__" />
|
<define name="__REACTOS__" />
|
||||||
<define name="__USE_W32API" />
|
<define name="__USE_W32API" />
|
||||||
<define name="_WIN32_IE">0x600</define>
|
<define name="_WIN32_IE">0x600</define>
|
||||||
<define name="_WIN32_WINNT">0x501</define>
|
<define name="_WIN32_WINNT">0x600</define>
|
||||||
|
<define name="WINVER">0x609</define>
|
||||||
<library>kernel32</library>
|
<library>kernel32</library>
|
||||||
<library>user32</library>
|
<library>user32</library>
|
||||||
<library>comctl32</library>
|
<library>comctl32</library>
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <commctrl.h>
|
#include <commctrl.h>
|
||||||
#include <cpl.h>
|
#include <cpl.h>
|
||||||
|
#include <tchar.h>
|
||||||
|
|
||||||
#include "intl.h"
|
#include "intl.h"
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
|
@ -8,41 +9,44 @@
|
||||||
/* Property page dialog callback */
|
/* Property page dialog callback */
|
||||||
INT_PTR CALLBACK
|
INT_PTR CALLBACK
|
||||||
LanguagesPageProc(HWND hwndDlg,
|
LanguagesPageProc(HWND hwndDlg,
|
||||||
UINT uMsg,
|
UINT uMsg,
|
||||||
WPARAM wParam,
|
WPARAM wParam,
|
||||||
LPARAM lParam)
|
LPARAM lParam)
|
||||||
{
|
{
|
||||||
SHELLEXECUTEINFOW shInputDll;
|
SHELLEXECUTEINFO shInputDll;
|
||||||
switch(uMsg)
|
|
||||||
{
|
switch (uMsg)
|
||||||
case WM_INITDIALOG:
|
{
|
||||||
break;
|
case WM_INITDIALOG:
|
||||||
case WM_COMMAND:
|
break;
|
||||||
switch (LOWORD(wParam))
|
|
||||||
{
|
case WM_COMMAND:
|
||||||
/* If "detail" button pressed */
|
switch (LOWORD(wParam))
|
||||||
case IDC_DETAIL_BUTTON:
|
{
|
||||||
if(HIWORD(wParam)==BN_CLICKED)
|
/* If "detail" button pressed */
|
||||||
{
|
case IDC_DETAIL_BUTTON:
|
||||||
memset(&shInputDll, 0x0, sizeof(SHELLEXECUTEINFOW));
|
if (HIWORD(wParam) == BN_CLICKED)
|
||||||
shInputDll.cbSize = sizeof(shInputDll);
|
|
||||||
shInputDll.hwnd = hwndDlg;
|
|
||||||
shInputDll.lpVerb = L"open";
|
|
||||||
shInputDll.lpFile = L"RunDll32.exe";
|
|
||||||
shInputDll.lpParameters = L"shell32.dll,Control_RunDLL input.dll";
|
|
||||||
if(ShellExecuteExW(&shInputDll)==0)
|
|
||||||
{
|
{
|
||||||
MessageBox(NULL, L"Can't start input.dll", L"Error", MB_OK | MB_ICONERROR);
|
memset(&shInputDll, 0x0, sizeof(SHELLEXECUTEINFO));
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
MessageBox(NULL,
|
||||||
|
_T("Can't start input.dll"),
|
||||||
|
_T("Error"),
|
||||||
|
MB_OK | MB_ICONERROR);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
return FALSE;
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <commctrl.h>
|
#include <commctrl.h>
|
||||||
#include <cpl.h>
|
#include <cpl.h>
|
||||||
|
#include <tchar.h>
|
||||||
|
|
||||||
#include "intl.h"
|
#include "intl.h"
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
|
@ -8,139 +9,141 @@
|
||||||
#define NUM_SHEETS 4
|
#define NUM_SHEETS 4
|
||||||
|
|
||||||
/* Insert the space */
|
/* Insert the space */
|
||||||
WCHAR*
|
LPTSTR
|
||||||
InsSpacePos(const WCHAR *wszInsStr, const int nPos)
|
InsSpacePos(LPCTSTR szInsStr, const int nPos)
|
||||||
{
|
{
|
||||||
WCHAR* pwszDestStr;
|
LPTSTR pszDestStr;
|
||||||
pwszDestStr=(WCHAR*) malloc(MAX_SAMPLES_STR_SIZE);
|
INT nDestStrCnt = 0;
|
||||||
|
INT nStrCnt;
|
||||||
|
INT nStrSize;
|
||||||
|
|
||||||
int nDestStrCnt=0;
|
pszDestStr = (LPTSTR)malloc(MAX_SAMPLES_STR_SIZE * sizeof(TCHAR));
|
||||||
int nStrCnt;
|
|
||||||
int nStrSize;
|
|
||||||
|
|
||||||
wcscpy(pwszDestStr,wszInsStr);
|
_tcscpy(pszDestStr, szInsStr);
|
||||||
|
|
||||||
nStrSize = wcslen(wszInsStr);
|
nStrSize = _tcslen(szInsStr);
|
||||||
|
|
||||||
for(nStrCnt=0; nStrCnt<nStrSize; nStrCnt++)
|
for (nStrCnt = 0; nStrCnt < nStrSize; nStrCnt++)
|
||||||
{
|
{
|
||||||
if(nStrCnt==nStrSize-nPos)
|
if (nStrCnt == nStrSize - nPos)
|
||||||
{
|
{
|
||||||
pwszDestStr[nDestStrCnt]=' ';
|
pszDestStr[nDestStrCnt] = _T(' ');
|
||||||
nDestStrCnt++;
|
nDestStrCnt++;
|
||||||
}
|
}
|
||||||
pwszDestStr[nDestStrCnt]=wszInsStr[nStrCnt];
|
|
||||||
|
pszDestStr[nDestStrCnt] = szInsStr[nStrCnt];
|
||||||
nDestStrCnt++;
|
nDestStrCnt++;
|
||||||
}
|
}
|
||||||
pwszDestStr[nDestStrCnt]='\0';
|
|
||||||
|
|
||||||
return pwszDestStr;
|
pszDestStr[nDestStrCnt] = _T('\0');
|
||||||
|
|
||||||
|
return pszDestStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Insert the spaces by format string separated by ';' */
|
/* Insert the spaces by format string separated by ';' */
|
||||||
WCHAR*
|
LPTSTR
|
||||||
InsSpacesFmt(const WCHAR *wszSourceStr, const WCHAR *wszFmtStr)
|
InsSpacesFmt(LPCTSTR szSourceStr, LPCTSTR szFmtStr)
|
||||||
{
|
{
|
||||||
WCHAR* pwszDestStr;
|
LPTSTR pszDestStr;
|
||||||
pwszDestStr=(WCHAR*) malloc(255);
|
LPTSTR pszTempStr;
|
||||||
|
TCHAR szFmtVal[255];
|
||||||
WCHAR* pwszTempStr;
|
INT nFmtCount = 0;
|
||||||
|
INT nValCount = 0;
|
||||||
WCHAR wszFmtVal[255];
|
INT nLastVal = 0;
|
||||||
|
INT nSpaceOffset = 0;
|
||||||
int nFmtCount=0;
|
|
||||||
int nValCount=0;
|
|
||||||
int nLastVal=0;
|
|
||||||
int nSpaceOffset=0;
|
|
||||||
|
|
||||||
BOOL wasNul=FALSE;
|
BOOL wasNul=FALSE;
|
||||||
|
|
||||||
wcscpy(pwszDestStr,wszSourceStr);
|
pszDestStr = (LPTSTR)malloc(255 * sizeof(TCHAR));
|
||||||
|
|
||||||
|
_tcscpy(pszDestStr, szSourceStr);
|
||||||
|
|
||||||
/* if format is clean return source string */
|
/* if format is clean return source string */
|
||||||
if(!*wszFmtStr) return pwszDestStr;
|
if (!*szFmtStr)
|
||||||
|
return pszDestStr;
|
||||||
|
|
||||||
/* Search for all format values */
|
/* Search for all format values */
|
||||||
for(nFmtCount=0;nFmtCount<=(int)wcslen(wszFmtStr);nFmtCount++)
|
for (nFmtCount = 0; nFmtCount <= _tcslen(szFmtStr); nFmtCount++)
|
||||||
{
|
{
|
||||||
if(wszFmtStr[nFmtCount]==';' || wszFmtStr[nFmtCount]=='\0')
|
if (szFmtStr[nFmtCount] == _T(';') || szFmtStr[nFmtCount] == _T('\0'))
|
||||||
{
|
{
|
||||||
if(_wtoi(wszFmtVal)==0 && !wasNul)
|
if (_ttoi(szFmtVal) == 0 && !wasNul)
|
||||||
{
|
{
|
||||||
wasNul=TRUE;
|
wasNul=TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If was 0, repeat spaces */
|
/* If was 0, repeat spaces */
|
||||||
if(wasNul)
|
if (wasNul)
|
||||||
{
|
{
|
||||||
nSpaceOffset+=nLastVal;
|
nSpaceOffset += nLastVal;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
nSpaceOffset+=_wtoi(wszFmtVal);
|
nSpaceOffset += _ttoi(szFmtVal);
|
||||||
}
|
}
|
||||||
wszFmtVal[nValCount]='\0';
|
|
||||||
nValCount=0;
|
|
||||||
/* insert space to finded position plus all pos before */
|
|
||||||
pwszTempStr=InsSpacePos(pwszDestStr,nSpaceOffset);
|
|
||||||
wcscpy(pwszDestStr,pwszTempStr);
|
|
||||||
free(pwszTempStr);
|
|
||||||
/* num of spaces total increment */
|
|
||||||
|
|
||||||
if(!wasNul)
|
szFmtVal[nValCount] = _T('\0');
|
||||||
|
nValCount=0;
|
||||||
|
|
||||||
|
/* insert space to finded position plus all pos before */
|
||||||
|
pszTempStr = InsSpacePos(pszDestStr, nSpaceOffset);
|
||||||
|
_tcscpy(pszDestStr,pszTempStr);
|
||||||
|
free(pszTempStr);
|
||||||
|
|
||||||
|
/* num of spaces total increment */
|
||||||
|
if (!wasNul)
|
||||||
{
|
{
|
||||||
nSpaceOffset++;
|
nSpaceOffset++;
|
||||||
nLastVal=_wtoi(wszFmtVal);
|
nLastVal = _ttoi(szFmtVal);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wszFmtVal[nValCount++]=wszFmtStr[nFmtCount];
|
szFmtVal[nValCount++] = szFmtStr[nFmtCount];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create spaces for rest part of string */
|
/* Create spaces for rest part of string */
|
||||||
if(wasNul && nLastVal!=0)
|
if (wasNul && nLastVal != 0)
|
||||||
{
|
{
|
||||||
for(nFmtCount=nSpaceOffset+nLastVal;nFmtCount<wcslen(pwszDestStr);nFmtCount+=nLastVal+1)
|
for (nFmtCount = nSpaceOffset + nLastVal; nFmtCount < _tcslen(pszDestStr); nFmtCount += nLastVal + 1)
|
||||||
{
|
{
|
||||||
pwszTempStr=InsSpacePos(pwszDestStr,nFmtCount);
|
pszTempStr = InsSpacePos(pszDestStr, nFmtCount);
|
||||||
wcscpy(pwszDestStr,pwszTempStr);
|
_tcscpy(pszDestStr, pszTempStr);
|
||||||
free(pwszTempStr);
|
free(pszTempStr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return pwszDestStr;
|
return pszDestStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Replace given template in source string with string to replace and return recieved string */
|
/* Replace given template in source string with string to replace and return recieved string */
|
||||||
WCHAR*
|
LPTSTR
|
||||||
ReplaceSubStr(const WCHAR *wszSourceStr,
|
ReplaceSubStr(LPCTSTR szSourceStr,
|
||||||
const WCHAR *wszStrToReplace,
|
LPCTSTR szStrToReplace,
|
||||||
const WCHAR *wszTempl)
|
LPCTSTR szTempl)
|
||||||
{
|
{
|
||||||
int nCharCnt;
|
LPTSTR szDestStr;
|
||||||
int nSubStrCnt;
|
INT nCharCnt;
|
||||||
int nDestStrCnt;
|
INT nSubStrCnt;
|
||||||
int nFirstCharCnt;
|
INT nDestStrCnt;
|
||||||
|
INT nFirstCharCnt;
|
||||||
|
|
||||||
WCHAR* wszDestStr;
|
szDestStr = (LPTSTR)malloc(MAX_SAMPLES_STR_SIZE * sizeof(TCHAR));
|
||||||
wszDestStr=(WCHAR*) malloc(MAX_SAMPLES_STR_SIZE*sizeof(WCHAR));
|
|
||||||
|
|
||||||
nDestStrCnt=0;
|
nDestStrCnt = 0;
|
||||||
nFirstCharCnt=0;
|
nFirstCharCnt = 0;
|
||||||
|
|
||||||
wcscpy(wszDestStr,L"");
|
_tcscpy(szDestStr, _T(""));
|
||||||
|
|
||||||
while(nFirstCharCnt<(int)wcslen(wszSourceStr))
|
while (nFirstCharCnt < _tcslen(szSourceStr))
|
||||||
{
|
{
|
||||||
if(wszSourceStr[nFirstCharCnt]==wszTempl[0])
|
if (szSourceStr[nFirstCharCnt] == szTempl[0])
|
||||||
{
|
{
|
||||||
nSubStrCnt=0;
|
nSubStrCnt = 0;
|
||||||
for(nCharCnt=nFirstCharCnt;nCharCnt<nFirstCharCnt+(int)wcslen(wszTempl);nCharCnt++)
|
for (nCharCnt = nFirstCharCnt; nCharCnt < nFirstCharCnt + _tcslen(szTempl); nCharCnt++)
|
||||||
{
|
{
|
||||||
if(wszSourceStr[nCharCnt]==wszTempl[nSubStrCnt])
|
if (szSourceStr[nCharCnt] == szTempl[nSubStrCnt])
|
||||||
{
|
{
|
||||||
nSubStrCnt++;
|
nSubStrCnt++;
|
||||||
}
|
}
|
||||||
|
@ -148,24 +151,26 @@ ReplaceSubStr(const WCHAR *wszSourceStr,
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if((int)wcslen(wszTempl)==nSubStrCnt)
|
|
||||||
|
if (_tcslen(szTempl) == nSubStrCnt)
|
||||||
{
|
{
|
||||||
wcscat(wszDestStr,wszStrToReplace);
|
_tcscat(szDestStr, szStrToReplace);
|
||||||
nDestStrCnt=(int)wcslen(wszDestStr);
|
nDestStrCnt = _tcslen(szDestStr);
|
||||||
nFirstCharCnt+=(int)wcslen(wszTempl)-1;
|
nFirstCharCnt += _tcslen(szTempl) - 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wszDestStr[nDestStrCnt++]=wszSourceStr[nFirstCharCnt];
|
szDestStr[nDestStrCnt++] = szSourceStr[nFirstCharCnt];
|
||||||
wszDestStr[nDestStrCnt]='\0';
|
szDestStr[nDestStrCnt] = _T('\0');
|
||||||
}
|
}
|
||||||
nFirstCharCnt++;
|
|
||||||
}
|
|
||||||
|
|
||||||
return wszDestStr;
|
nFirstCharCnt++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return szDestStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create applets */
|
/* Create applets */
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -11,6 +11,7 @@
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <commctrl.h>
|
#include <commctrl.h>
|
||||||
#include <cpl.h>
|
#include <cpl.h>
|
||||||
|
#include <tchar.h>
|
||||||
|
|
||||||
#include "intl.h"
|
#include "intl.h"
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
|
@ -22,139 +23,140 @@
|
||||||
/* FUNCTIONS ****************************************************************/
|
/* FUNCTIONS ****************************************************************/
|
||||||
|
|
||||||
/* Insert the space */
|
/* Insert the space */
|
||||||
WCHAR*
|
TCHAR*
|
||||||
InsSpacePos(const WCHAR *wszInsStr, const int nPos)
|
InsSpacePos(const TCHAR *szInsStr, const int nPos)
|
||||||
{
|
{
|
||||||
WCHAR* pwszDestStr;
|
LPTSTR pszDestStr;
|
||||||
pwszDestStr=(WCHAR*) malloc(MAX_SAMPLES_STR_SIZE);
|
|
||||||
|
|
||||||
int nDestStrCnt=0;
|
int nDestStrCnt=0;
|
||||||
int nStrCnt;
|
int nStrCnt;
|
||||||
int nStrSize;
|
int nStrSize;
|
||||||
|
|
||||||
wcscpy(pwszDestStr,wszInsStr);
|
pszDestStr = (LPTSTR)malloc(MAX_SAMPLES_STR_SIZE * sizeof(TCHAR));
|
||||||
|
|
||||||
nStrSize = wcslen(wszInsStr);
|
_tcscpy(pszDestStr, szInsStr);
|
||||||
|
|
||||||
for(nStrCnt=0; nStrCnt<nStrSize; nStrCnt++)
|
nStrSize = _tcslen(szInsStr);
|
||||||
|
|
||||||
|
for (nStrCnt = 0; nStrCnt < nStrSize; nStrCnt++)
|
||||||
{
|
{
|
||||||
if(nStrCnt==nStrSize-nPos)
|
if (nStrCnt == nStrSize - nPos)
|
||||||
{
|
{
|
||||||
pwszDestStr[nDestStrCnt]=' ';
|
pszDestStr[nDestStrCnt] = _T(' ');
|
||||||
nDestStrCnt++;
|
nDestStrCnt++;
|
||||||
}
|
}
|
||||||
pwszDestStr[nDestStrCnt]=wszInsStr[nStrCnt];
|
|
||||||
|
pszDestStr[nDestStrCnt] = szInsStr[nStrCnt];
|
||||||
nDestStrCnt++;
|
nDestStrCnt++;
|
||||||
}
|
}
|
||||||
pwszDestStr[nDestStrCnt]='\0';
|
|
||||||
|
|
||||||
return pwszDestStr;
|
pszDestStr[nDestStrCnt] = _T('\0');
|
||||||
|
|
||||||
|
return pszDestStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Insert the spaces by format string separated by ';' */
|
/* Insert the spaces by format string separated by ';' */
|
||||||
WCHAR*
|
LPTSTR
|
||||||
InsSpacesFmt(const WCHAR *wszSourceStr, const WCHAR *wszFmtStr)
|
InsSpacesFmt(const TCHAR *szSourceStr, const TCHAR *szFmtStr)
|
||||||
{
|
{
|
||||||
WCHAR* pwszDestStr;
|
LPTSTR pszDestStr;
|
||||||
pwszDestStr=(WCHAR*) malloc(255);
|
LPTSTR pszTempStr;
|
||||||
|
TCHAR szFmtVal[255];
|
||||||
WCHAR* pwszTempStr;
|
int nFmtCount=0;
|
||||||
|
int nValCount=0;
|
||||||
WCHAR wszFmtVal[255];
|
|
||||||
|
|
||||||
int nFmtCount=0;
|
|
||||||
int nValCount=0;
|
|
||||||
int nLastVal=0;
|
int nLastVal=0;
|
||||||
int nSpaceOffset=0;
|
int nSpaceOffset=0;
|
||||||
|
|
||||||
BOOL wasNul=FALSE;
|
BOOL wasNul=FALSE;
|
||||||
|
|
||||||
wcscpy(pwszDestStr,wszSourceStr);
|
pszDestStr = (LPTSTR) malloc(255 * sizeof(TCHAR));
|
||||||
|
|
||||||
|
_tcscpy(pszDestStr, szSourceStr);
|
||||||
|
|
||||||
/* if format is clean return source string */
|
/* if format is clean return source string */
|
||||||
if(!*wszFmtStr) return pwszDestStr;
|
if (!*szFmtStr)
|
||||||
|
return pszDestStr;
|
||||||
|
|
||||||
/* Search for all format values */
|
/* Search for all format values */
|
||||||
for(nFmtCount=0;nFmtCount<=(int)wcslen(wszFmtStr);nFmtCount++)
|
for (nFmtCount = 0; nFmtCount <= (int)_tcslen(szFmtStr); nFmtCount++)
|
||||||
{
|
{
|
||||||
if(wszFmtStr[nFmtCount]==';' || wszFmtStr[nFmtCount]=='\0')
|
if (szFmtStr[nFmtCount] == _T(';') || szFmtStr[nFmtCount] == _T('\0'))
|
||||||
{
|
{
|
||||||
if(_wtoi(wszFmtVal)==0 && !wasNul)
|
if (_ttoi(szFmtVal) == 0 && !wasNul)
|
||||||
{
|
{
|
||||||
wasNul=TRUE;
|
wasNul = TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If was 0, repeat spaces */
|
/* If was 0, repeat spaces */
|
||||||
if(wasNul)
|
if (wasNul)
|
||||||
{
|
{
|
||||||
nSpaceOffset+=nLastVal;
|
nSpaceOffset += nLastVal;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
nSpaceOffset+=_wtoi(wszFmtVal);
|
nSpaceOffset += _ttoi(szFmtVal);
|
||||||
}
|
}
|
||||||
wszFmtVal[nValCount]='\0';
|
|
||||||
nValCount=0;
|
|
||||||
/* insert space to finded position plus all pos before */
|
|
||||||
pwszTempStr=InsSpacePos(pwszDestStr,nSpaceOffset);
|
|
||||||
wcscpy(pwszDestStr,pwszTempStr);
|
|
||||||
free(pwszTempStr);
|
|
||||||
/* num of spaces total increment */
|
|
||||||
|
|
||||||
if(!wasNul)
|
szFmtVal[nValCount] = _T('\0');
|
||||||
|
nValCount=0;
|
||||||
|
|
||||||
|
/* insert space to finded position plus all pos before */
|
||||||
|
pszTempStr = InsSpacePos(pszDestStr, nSpaceOffset);
|
||||||
|
_tcscpy(pszDestStr, pszTempStr);
|
||||||
|
free(pszTempStr);
|
||||||
|
|
||||||
|
/* num of spaces total increment */
|
||||||
|
if (!wasNul)
|
||||||
{
|
{
|
||||||
nSpaceOffset++;
|
nSpaceOffset++;
|
||||||
nLastVal=_wtoi(wszFmtVal);
|
nLastVal = _ttoi(szFmtVal);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wszFmtVal[nValCount++]=wszFmtStr[nFmtCount];
|
szFmtVal[nValCount++] = szFmtStr[nFmtCount];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create spaces for rest part of string */
|
/* Create spaces for rest part of string */
|
||||||
if(wasNul && nLastVal!=0)
|
if (wasNul && nLastVal!=0)
|
||||||
{
|
{
|
||||||
for(nFmtCount=nSpaceOffset+nLastVal;nFmtCount<wcslen(pwszDestStr);nFmtCount+=nLastVal+1)
|
for (nFmtCount = nSpaceOffset + nLastVal; nFmtCount < _tcslen(pszDestStr); nFmtCount += nLastVal + 1)
|
||||||
{
|
{
|
||||||
pwszTempStr=InsSpacePos(pwszDestStr,nFmtCount);
|
pszTempStr = InsSpacePos(pszDestStr, nFmtCount);
|
||||||
wcscpy(pwszDestStr,pwszTempStr);
|
_tcscpy(pszDestStr,pszTempStr);
|
||||||
free(pwszTempStr);
|
free(pszTempStr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return pwszDestStr;
|
return pszDestStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Replace given template in source string with string to replace and return recieved string */
|
/* Replace given template in source string with string to replace and return recieved string */
|
||||||
WCHAR*
|
TCHAR*
|
||||||
ReplaceSubStr(const WCHAR *wszSourceStr,
|
ReplaceSubStr(const TCHAR *szSourceStr,
|
||||||
const WCHAR *wszStrToReplace,
|
const TCHAR *szStrToReplace,
|
||||||
const WCHAR *wszTempl)
|
const TCHAR *szTempl)
|
||||||
{
|
{
|
||||||
int nCharCnt;
|
int nCharCnt;
|
||||||
int nSubStrCnt;
|
int nSubStrCnt;
|
||||||
int nDestStrCnt;
|
int nDestStrCnt;
|
||||||
int nFirstCharCnt;
|
int nFirstCharCnt;
|
||||||
|
LPTSTR szDestStr;
|
||||||
|
|
||||||
WCHAR* wszDestStr;
|
szDestStr = (LPTSTR)malloc(MAX_SAMPLES_STR_SIZE * sizeof(TCHAR));
|
||||||
wszDestStr=(WCHAR*) malloc(MAX_SAMPLES_STR_SIZE*sizeof(WCHAR));
|
nDestStrCnt = 0;
|
||||||
|
nFirstCharCnt = 0;
|
||||||
|
|
||||||
nDestStrCnt=0;
|
_tcscpy(szDestStr, _T(L""));
|
||||||
nFirstCharCnt=0;
|
|
||||||
|
|
||||||
wcscpy(wszDestStr,L"");
|
while (nFirstCharCnt < (int)_tcslen(szSourceStr))
|
||||||
|
{
|
||||||
while(nFirstCharCnt<(int)wcslen(wszSourceStr))
|
if (szSourceStr[nFirstCharCnt] == szTempl[0])
|
||||||
{
|
|
||||||
if(wszSourceStr[nFirstCharCnt]==wszTempl[0])
|
|
||||||
{
|
{
|
||||||
nSubStrCnt=0;
|
nSubStrCnt=0;
|
||||||
for(nCharCnt=nFirstCharCnt;nCharCnt<nFirstCharCnt+(int)wcslen(wszTempl);nCharCnt++)
|
for (nCharCnt = nFirstCharCnt; nCharCnt < nFirstCharCnt + (int)_tcslen(szTempl); nCharCnt++)
|
||||||
{
|
{
|
||||||
if(wszSourceStr[nCharCnt]==wszTempl[nSubStrCnt])
|
if (szSourceStr[nCharCnt] == szTempl[nSubStrCnt])
|
||||||
{
|
{
|
||||||
nSubStrCnt++;
|
nSubStrCnt++;
|
||||||
}
|
}
|
||||||
|
@ -162,24 +164,26 @@ ReplaceSubStr(const WCHAR *wszSourceStr,
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if((int)wcslen(wszTempl)==nSubStrCnt)
|
|
||||||
|
if ((int)_tcslen(szTempl) == nSubStrCnt)
|
||||||
{
|
{
|
||||||
wcscat(wszDestStr,wszStrToReplace);
|
_tcscat(szDestStr, szStrToReplace);
|
||||||
nDestStrCnt=(int)wcslen(wszDestStr);
|
nDestStrCnt = (int)_tcslen(szDestStr);
|
||||||
nFirstCharCnt+=(int)wcslen(wszTempl)-1;
|
nFirstCharCnt += (int)_tcslen(szTempl) - 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wszDestStr[nDestStrCnt++]=wszSourceStr[nFirstCharCnt];
|
szDestStr[nDestStrCnt++] = wszSourceStr[nFirstCharCnt];
|
||||||
wszDestStr[nDestStrCnt]='\0';
|
szDestStr[nDestStrCnt] = _T('\0');
|
||||||
}
|
}
|
||||||
nFirstCharCnt++;
|
|
||||||
}
|
|
||||||
|
|
||||||
return wszDestStr;
|
nFirstCharCnt++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return szDestStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
|
|
|
@ -26,26 +26,27 @@
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <commctrl.h>
|
#include <commctrl.h>
|
||||||
#include <cpl.h>
|
#include <cpl.h>
|
||||||
|
#include <tchar.h>
|
||||||
|
|
||||||
#include "intl.h"
|
#include "intl.h"
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* TODO:
|
* TODO:
|
||||||
* - Enumerate available time formats (use EnumTimeformatsW)
|
* - Enumerate available time formats (use EnumTimeFormats)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static VOID
|
static VOID
|
||||||
UpdateTimeSample(HWND hWnd)
|
UpdateTimeSample(HWND hWnd)
|
||||||
{
|
{
|
||||||
WCHAR InBuffer[80];
|
TCHAR InBuffer[80];
|
||||||
WCHAR OutBuffer[80];
|
TCHAR OutBuffer[80];
|
||||||
|
|
||||||
GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_STIMEFORMAT, InBuffer, 80);
|
GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_STIMEFORMAT, InBuffer, 80);
|
||||||
|
|
||||||
GetTimeFormatW(LOCALE_USER_DEFAULT, 0, NULL, InBuffer, OutBuffer, 80);
|
GetTimeFormat(LOCALE_USER_DEFAULT, 0, NULL, InBuffer, OutBuffer, 80);
|
||||||
|
|
||||||
SendMessageW(hWnd, WM_SETTEXT, 0, (LPARAM)OutBuffer);
|
SendMessage(hWnd, WM_SETTEXT, 0, (LPARAM)OutBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -56,81 +57,81 @@ TimePageProc(HWND hwndDlg,
|
||||||
WPARAM wParam,
|
WPARAM wParam,
|
||||||
LPARAM lParam)
|
LPARAM lParam)
|
||||||
{
|
{
|
||||||
switch(uMsg)
|
switch (uMsg)
|
||||||
{
|
{
|
||||||
case WM_INITDIALOG:
|
case WM_INITDIALOG:
|
||||||
{
|
{
|
||||||
WCHAR Buffer[80];
|
TCHAR Buffer[80];
|
||||||
int nLen;
|
int nLen;
|
||||||
|
|
||||||
/* Update the time format sample */
|
/* Update the time format sample */
|
||||||
UpdateTimeSample(GetDlgItem(hwndDlg, IDC_TIMESAMPLE));
|
UpdateTimeSample(GetDlgItem(hwndDlg, IDC_TIMESAMPLE));
|
||||||
|
|
||||||
/* Get the time format (max. 80 characters) */
|
/* Get the time format (max. 80 characters) */
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEFORMAT),
|
SendMessage(GetDlgItem(hwndDlg, IDC_TIMEFORMAT),
|
||||||
CB_LIMITTEXT, 80, 0);
|
CB_LIMITTEXT, 80, 0);
|
||||||
|
|
||||||
/* FIXME: add available time formats to the list */
|
/* FIXME: add available time formats to the list */
|
||||||
|
|
||||||
GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_STIMEFORMAT, Buffer, 80);
|
GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_STIMEFORMAT, Buffer, 80);
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEFORMAT),
|
SendMessage(GetDlgItem(hwndDlg, IDC_TIMEFORMAT),
|
||||||
CB_ADDSTRING,
|
CB_ADDSTRING,
|
||||||
0,
|
0,
|
||||||
(LPARAM)Buffer);
|
(LPARAM)Buffer);
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEFORMAT),
|
SendMessage(GetDlgItem(hwndDlg, IDC_TIMEFORMAT),
|
||||||
CB_SETCURSEL,
|
CB_SETCURSEL,
|
||||||
0, /* index */
|
0, /* index */
|
||||||
0);
|
0);
|
||||||
|
|
||||||
/* Get the time separator (max. 4 characters) */
|
/* Get the time separator (max. 4 characters) */
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMESEPARATOR),
|
SendMessage(GetDlgItem(hwndDlg, IDC_TIMESEPARATOR),
|
||||||
CB_LIMITTEXT, 4, 0);
|
CB_LIMITTEXT, 4, 0);
|
||||||
GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_STIME, Buffer, 80);
|
GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_STIME, Buffer, 80);
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMESEPARATOR),
|
SendMessage(GetDlgItem(hwndDlg, IDC_TIMESEPARATOR),
|
||||||
CB_ADDSTRING,
|
CB_ADDSTRING,
|
||||||
0,
|
0,
|
||||||
(LPARAM)Buffer);
|
(LPARAM)Buffer);
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMESEPARATOR),
|
SendMessage(GetDlgItem(hwndDlg, IDC_TIMESEPARATOR),
|
||||||
CB_SETCURSEL,
|
CB_SETCURSEL,
|
||||||
0, /* index */
|
0, /* index */
|
||||||
0);
|
0);
|
||||||
|
|
||||||
/* Get the AM symbol (max. 9 characters) */
|
/* Get the AM symbol (max. 9 characters) */
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEAMSYMBOL),
|
SendMessage(GetDlgItem(hwndDlg, IDC_TIMEAMSYMBOL),
|
||||||
CB_LIMITTEXT, 9, 0);
|
CB_LIMITTEXT, 9, 0);
|
||||||
nLen = GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_S1159, Buffer, 80);
|
nLen = GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_S1159, Buffer, 80);
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEAMSYMBOL),
|
SendMessage(GetDlgItem(hwndDlg, IDC_TIMEAMSYMBOL),
|
||||||
CB_ADDSTRING,
|
CB_ADDSTRING,
|
||||||
0,
|
0,
|
||||||
(LPARAM)Buffer);
|
(LPARAM)Buffer);
|
||||||
if (nLen != 0)
|
if (nLen != 0)
|
||||||
{
|
{
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEAMSYMBOL),
|
SendMessage(GetDlgItem(hwndDlg, IDC_TIMEAMSYMBOL),
|
||||||
CB_ADDSTRING,
|
CB_ADDSTRING,
|
||||||
0,
|
0,
|
||||||
(LPARAM)L"");
|
(LPARAM)_T(""));
|
||||||
}
|
}
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEAMSYMBOL),
|
SendMessage(GetDlgItem(hwndDlg, IDC_TIMEAMSYMBOL),
|
||||||
CB_SETCURSEL,
|
CB_SETCURSEL,
|
||||||
0, /* index */
|
0, /* index */
|
||||||
0);
|
0);
|
||||||
|
|
||||||
/* Get the PM symbol (max. 9 characters) */
|
/* Get the PM symbol (max. 9 characters) */
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEPMSYMBOL),
|
SendMessage(GetDlgItem(hwndDlg, IDC_TIMEPMSYMBOL),
|
||||||
CB_LIMITTEXT, 9, 0);
|
CB_LIMITTEXT, 9, 0);
|
||||||
nLen = GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_S2359, Buffer, 80);
|
nLen = GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_S2359, Buffer, 80);
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEPMSYMBOL),
|
SendMessage(GetDlgItem(hwndDlg, IDC_TIMEPMSYMBOL),
|
||||||
CB_ADDSTRING,
|
CB_ADDSTRING,
|
||||||
0,
|
0,
|
||||||
(LPARAM)Buffer);
|
(LPARAM)Buffer);
|
||||||
if (nLen != 0)
|
if (nLen != 0)
|
||||||
{
|
{
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEPMSYMBOL),
|
SendMessage(GetDlgItem(hwndDlg, IDC_TIMEPMSYMBOL),
|
||||||
CB_ADDSTRING,
|
CB_ADDSTRING,
|
||||||
0,
|
0,
|
||||||
(LPARAM)L"");
|
(LPARAM)_T(""));
|
||||||
}
|
}
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEPMSYMBOL),
|
SendMessage(GetDlgItem(hwndDlg, IDC_TIMEPMSYMBOL),
|
||||||
CB_SETCURSEL,
|
CB_SETCURSEL,
|
||||||
0, /* index */
|
0, /* index */
|
||||||
0);
|
0);
|
||||||
|
@ -159,49 +160,49 @@ TimePageProc(HWND hwndDlg,
|
||||||
|
|
||||||
if (lpnm->code == (UINT)PSN_APPLY)
|
if (lpnm->code == (UINT)PSN_APPLY)
|
||||||
{
|
{
|
||||||
WCHAR Buffer[80];
|
TCHAR Buffer[80];
|
||||||
int nIndex;
|
int nIndex;
|
||||||
|
|
||||||
/* Set time format */
|
/* Set time format */
|
||||||
nIndex = SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEFORMAT),
|
nIndex = SendMessage(GetDlgItem(hwndDlg, IDC_TIMEFORMAT),
|
||||||
CB_GETCURSEL, 0, 0);
|
CB_GETCURSEL, 0, 0);
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEFORMAT),
|
SendMessage(GetDlgItem(hwndDlg, IDC_TIMEFORMAT),
|
||||||
CB_GETLBTEXT, (WPARAM)nIndex, (LPARAM)Buffer);
|
CB_GETLBTEXT, (WPARAM)nIndex, (LPARAM)Buffer);
|
||||||
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_STIMEFORMAT, Buffer);
|
SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_STIMEFORMAT, Buffer);
|
||||||
|
|
||||||
/* Set time separator */
|
/* Set time separator */
|
||||||
nIndex = SendMessageW(GetDlgItem(hwndDlg, IDC_TIMESEPARATOR),
|
nIndex = SendMessage(GetDlgItem(hwndDlg, IDC_TIMESEPARATOR),
|
||||||
CB_GETCURSEL, 0, 0);
|
CB_GETCURSEL, 0, 0);
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMESEPARATOR),
|
SendMessage(GetDlgItem(hwndDlg, IDC_TIMESEPARATOR),
|
||||||
CB_GETLBTEXT, (WPARAM)nIndex, (LPARAM)Buffer);
|
CB_GETLBTEXT, (WPARAM)nIndex, (LPARAM)Buffer);
|
||||||
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_STIME, Buffer);
|
SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_STIME, Buffer);
|
||||||
|
|
||||||
/* Set the AM symbol */
|
/* Set the AM symbol */
|
||||||
nIndex = SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEAMSYMBOL),
|
nIndex = SendMessage(GetDlgItem(hwndDlg, IDC_TIMEAMSYMBOL),
|
||||||
CB_GETCURSEL, 0, 0);
|
CB_GETCURSEL, 0, 0);
|
||||||
if (nIndex != CB_ERR)
|
if (nIndex != CB_ERR)
|
||||||
{
|
{
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEAMSYMBOL),
|
SendMessage(GetDlgItem(hwndDlg, IDC_TIMEAMSYMBOL),
|
||||||
CB_GETLBTEXT, (WPARAM)nIndex, (LPARAM)Buffer);
|
CB_GETLBTEXT, (WPARAM)nIndex, (LPARAM)Buffer);
|
||||||
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_S1159, Buffer);
|
SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_S1159, Buffer);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_S1159, L"");
|
SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_S1159, _T(""));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set the PM symbol */
|
/* Set the PM symbol */
|
||||||
nIndex = SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEPMSYMBOL),
|
nIndex = SendMessage(GetDlgItem(hwndDlg, IDC_TIMEPMSYMBOL),
|
||||||
CB_GETCURSEL, 0, 0);
|
CB_GETCURSEL, 0, 0);
|
||||||
if (nIndex != CB_ERR)
|
if (nIndex != CB_ERR)
|
||||||
{
|
{
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEPMSYMBOL),
|
SendMessage(GetDlgItem(hwndDlg, IDC_TIMEPMSYMBOL),
|
||||||
CB_GETLBTEXT, (WPARAM)nIndex, (LPARAM)Buffer);
|
CB_GETLBTEXT, (WPARAM)nIndex, (LPARAM)Buffer);
|
||||||
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_S2359, Buffer);
|
SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_S2359, Buffer);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_S2359, L"");
|
SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_S2359, _T(""));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Update the time format sample */
|
/* Update the time format sample */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue