diff --git a/reactos/dll/cpl/intl/advanced.c b/reactos/dll/cpl/intl/advanced.c index 75a8e45ecac..c455e0a3ae3 100644 --- a/reactos/dll/cpl/intl/advanced.c +++ b/reactos/dll/cpl/intl/advanced.c @@ -8,16 +8,17 @@ /* Property page dialog callback */ INT_PTR CALLBACK AdvancedPageProc(HWND hwndDlg, - UINT uMsg, - WPARAM wParam, - LPARAM lParam) + UINT uMsg, + WPARAM wParam, + LPARAM lParam) { - switch(uMsg) - { - case WM_INITDIALOG: - break; - } - return FALSE; + switch(uMsg) + { + case WM_INITDIALOG: + break; + } + + return FALSE; } /* EOF */ diff --git a/reactos/dll/cpl/intl/currency.c b/reactos/dll/cpl/intl/currency.c index a7a7850982e..b433bf7f93d 100644 --- a/reactos/dll/cpl/intl/currency.c +++ b/reactos/dll/cpl/intl/currency.c @@ -32,8 +32,8 @@ #include "intl.h" #include "resource.h" -#define POSITIVE_EXAMPLE L"123456789.00" -#define NEGATIVE_EXAMPLE L"-123456789.00" +#define POSITIVE_EXAMPLE _T("123456789.00") +#define NEGATIVE_EXAMPLE _T("-123456789.00") #define MAX_FIELD_DIG_SAMPLES 3 @@ -90,9 +90,9 @@ GetInitialCurrencyValues(PGLOBAL_DATA pGlobalData) } /* Get decimal separator */ - ret = GetLocaleInfoW(LOCALE_USER_DEFAULT, - LOCALE_SMONDECIMALSEP, - pGlobalData->szDecimalSep, 4); + ret = GetLocaleInfo(LOCALE_USER_DEFAULT, + LOCALE_SMONDECIMALSEP, + pGlobalData->szDecimalSep, 4); /* Get group separator */ ret = GetLocaleInfo(LOCALE_USER_DEFAULT, @@ -103,7 +103,6 @@ GetInitialCurrencyValues(PGLOBAL_DATA pGlobalData) ret = GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SMONGROUPING, pGlobalData->szGrouping, 10); - } @@ -121,20 +120,20 @@ UpdateExamples(HWND hwndDlg, PGLOBAL_DATA pGlobalData) cyFmt.PositiveOrder = pGlobalData->PositiveOrder; cyFmt.NegativeOrder = pGlobalData->NegativeOrder; cyFmt.lpCurrencySymbol = pGlobalData->szCurrencySymbol; - + /* positive example */ - GetCurrencyFormatW(LOCALE_USER_DEFAULT, 0, + GetCurrencyFormat(LOCALE_USER_DEFAULT, 0, POSITIVE_EXAMPLE, &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 */ - GetCurrencyFormatW(LOCALE_USER_DEFAULT, 0, + GetCurrencyFormat(LOCALE_USER_DEFAULT, 0, NEGATIVE_EXAMPLE, &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); /* Set currency symbol */ - SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYSYMBOL), + SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYSYMBOL), CB_ADDSTRING, 0, (LPARAM)pGlobalData->szCurrencySymbol); - SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYSYMBOL), + SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYSYMBOL), CB_SETCURSEL, 0, /* index */ 0); @@ -175,13 +174,13 @@ OnInitDialog(HWND hwndDlg, PGLOBAL_DATA pGlobalData) _T("1.1"), &cyFmt, szBuffer, MAX_FMT_SIZE); - SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYPOSVALUE), + SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYPOSVALUE), CB_INSERTSTRING, -1, (LPARAM)szBuffer); } - SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYPOSVALUE), + SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYPOSVALUE), CB_SETCURSEL, pGlobalData->PositiveOrder, 0); @@ -195,53 +194,52 @@ OnInitDialog(HWND hwndDlg, PGLOBAL_DATA pGlobalData) _T("-1.1"), &cyFmt, szBuffer, MAX_FMT_SIZE); - SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYNEGVALUE), + SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYNEGVALUE), CB_INSERTSTRING, -1, (LPARAM)szBuffer); } - SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYNEGVALUE), + SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYNEGVALUE), CB_SETCURSEL, pGlobalData->NegativeOrder, /* index */ 0); /* decimal separator */ - SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYDECSEP), + SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYDECSEP), CB_ADDSTRING, 0, (LPARAM)pGlobalData->szDecimalSep); - SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYDECSEP), + SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYDECSEP), CB_SETCURSEL, 0, /* index */ 0); - /* */ for (i = 0; i < 10; i++) { szBuffer[0] = _T('0') + i; szBuffer[1] = 0; - SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYDECNUM), + SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYDECNUM), CB_ADDSTRING, 0, (LPARAM)szBuffer); } - SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYDECNUM), + SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYDECNUM), CB_SETCURSEL, pGlobalData->NumDigits, /* index */ 0); /* digit group separator */ - SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYGRPSEP), + SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYGRPSEP), CB_ADDSTRING, 0, (LPARAM)pGlobalData->szThousandSep); - SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYGRPSEP), + SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYGRPSEP), CB_SETCURSEL, 0, /* index */ 0); @@ -257,7 +255,7 @@ OnInitDialog(HWND hwndDlg, PGLOBAL_DATA pGlobalData) GetCurrencyFormat(LOCALE_USER_DEFAULT, 0, _T("123456789"), &cyFmt, szBuffer, MAX_FMT_SIZE); - SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYGRPNUM), + SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYGRPNUM), CB_INSERTSTRING, -1, (LPARAM)szBuffer); @@ -266,7 +264,7 @@ OnInitDialog(HWND hwndDlg, PGLOBAL_DATA pGlobalData) GetCurrencyFormat(LOCALE_USER_DEFAULT, 0, _T("123456789"), &cyFmt, szBuffer, MAX_FMT_SIZE); - SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYGRPNUM), + SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYGRPNUM), CB_INSERTSTRING, -1, (LPARAM)szBuffer); @@ -275,7 +273,7 @@ OnInitDialog(HWND hwndDlg, PGLOBAL_DATA pGlobalData) GetCurrencyFormat(LOCALE_USER_DEFAULT, 0, _T("123456789"), &cyFmt, szBuffer, MAX_FMT_SIZE); - SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYGRPNUM), + SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYGRPNUM), CB_INSERTSTRING, -1, (LPARAM)szBuffer); @@ -290,7 +288,7 @@ OnInitDialog(HWND hwndDlg, PGLOBAL_DATA pGlobalData) i = 1; } - SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYGRPNUM), + SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYGRPNUM), CB_SETCURSEL, i, /* index */ 0); @@ -300,149 +298,148 @@ OnInitDialog(HWND hwndDlg, PGLOBAL_DATA pGlobalData) } /* Set number of digidts in field */ -BOOL +static BOOL 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", - L"3;0", - L"3;2;0" + _T("0;0"), + _T("3;0"), + _T("3;2;0") }; int nCurrSel; /* Get setted number of digidts in field */ - nCurrSel=SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYGRPNUM), - CB_GETCURSEL, - (WPARAM)0, - (LPARAM)0); + nCurrSel = SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYGRPNUM), + CB_GETCURSEL, + (WPARAM)0, + (LPARAM)0); /* Save number of digidts in field */ - SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SMONGROUPING, wszFieldDigNumSamples[nCurrSel]); - + SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SMONGROUPING, szFieldDigNumSamples[nCurrSel]); return TRUE; } /* Set currency field separator */ -BOOL +static BOOL SetCurrencyFieldSep(HWND hwndDlg) { - WCHAR wszCurrencyFieldSep[MAX_SAMPLES_STR_SIZE]; + TCHAR szCurrencyFieldSep[MAX_SAMPLES_STR_SIZE]; /* Get setted currency field separator */ - SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYGRPSEP), - WM_GETTEXT, - (WPARAM)MAX_SAMPLES_STR_SIZE, - (LPARAM)(LPCSTR)wszCurrencyFieldSep); + SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYGRPSEP), + WM_GETTEXT, + (WPARAM)MAX_SAMPLES_STR_SIZE, + (LPARAM)szCurrencyFieldSep); /* Save currency field separator */ - SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SMONTHOUSANDSEP, wszCurrencyFieldSep); + SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SMONTHOUSANDSEP, szCurrencyFieldSep); return TRUE; } /* Set number of fractional symbols */ -BOOL +static BOOL SetCurrencyFracSymNum(HWND hwndDlg) { - WCHAR wszCurrencyFracSymNum[MAX_SAMPLES_STR_SIZE]; + TCHAR szCurrencyFracSymNum[MAX_SAMPLES_STR_SIZE]; INT nCurrSel; /* Get setted number of fractional symbols */ - nCurrSel=SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYDECNUM), - CB_GETCURSEL, - (WPARAM)0, - (LPARAM)0); + nCurrSel = SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYDECNUM), + CB_GETCURSEL, + (WPARAM)0, + (LPARAM)0); /* convert to wide char */ - _itow(nCurrSel,wszCurrencyFracSymNum,DECIMAL_RADIX); + _itot(nCurrSel, szCurrencyFracSymNum, DECIMAL_RADIX); /* Save number of fractional symbols */ - SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_ICURRDIGITS, wszCurrencyFracSymNum); + SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_ICURRDIGITS, szCurrencyFracSymNum); return TRUE; } /* Set currency separator */ -BOOL +static BOOL SetCurrencySep(HWND hwndDlg) { - WCHAR wszCurrencySep[MAX_SAMPLES_STR_SIZE]; + TCHAR szCurrencySep[MAX_SAMPLES_STR_SIZE]; /* Get setted currency decimal separator */ - SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYDECSEP), - WM_GETTEXT, - (WPARAM)MAX_SAMPLES_STR_SIZE, - (LPARAM)(LPCSTR)wszCurrencySep); + SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYDECSEP), + WM_GETTEXT, + (WPARAM)MAX_SAMPLES_STR_SIZE, + (LPARAM)szCurrencySep); /* TODO: Add check for correctly input */ /* Save currency separator */ - SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SMONDECIMALSEP, wszCurrencySep); + SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SMONDECIMALSEP, szCurrencySep); return TRUE; } /* Set negative currency sum format */ -BOOL +static BOOL SetNegCurrencySumFmt(HWND hwndDlg) { - WCHAR wszNegCurrencySumFmt[MAX_SAMPLES_STR_SIZE]; + TCHAR szNegCurrencySumFmt[MAX_SAMPLES_STR_SIZE]; INT nCurrSel; /* Get setted currency unit */ - nCurrSel=SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYNEGVALUE), - CB_GETCURSEL, - (WPARAM)0, - (LPARAM)0); + nCurrSel = SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYNEGVALUE), + CB_GETCURSEL, + (WPARAM)0, + (LPARAM)0); /* convert to wide char */ - _itow(nCurrSel,wszNegCurrencySumFmt,DECIMAL_RADIX); + _itot(nCurrSel, szNegCurrencySumFmt, DECIMAL_RADIX); /* Save currency sum format */ - SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_INEGCURR, wszNegCurrencySumFmt); + SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_INEGCURR, szNegCurrencySumFmt); return TRUE; } /* Set positive currency sum format */ -BOOL +static BOOL SetPosCurrencySumFmt(HWND hwndDlg) { - WCHAR wszPosCurrencySumFmt[MAX_SAMPLES_STR_SIZE]; + TCHAR szPosCurrencySumFmt[MAX_SAMPLES_STR_SIZE]; INT nCurrSel; /* Get setted currency unit */ - nCurrSel=SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYPOSVALUE), - CB_GETCURSEL, - (WPARAM)0, - (LPARAM)0); + nCurrSel = SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYPOSVALUE), + CB_GETCURSEL, + (WPARAM)0, + (LPARAM)0); /* convert to wide char */ - _itow(nCurrSel,wszPosCurrencySumFmt,DECIMAL_RADIX); + _itot(nCurrSel, szPosCurrencySumFmt, DECIMAL_RADIX); /* Save currency sum format */ - SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_ICURRENCY, wszPosCurrencySumFmt); + SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_ICURRENCY, szPosCurrencySumFmt); return TRUE; } /* Set currency unit */ -BOOL +static BOOL SetCurrencyUnit(HWND hwndDlg) { - WCHAR wszCurrencyUnit[MAX_SAMPLES_STR_SIZE]; + TCHAR szCurrencyUnit[MAX_SAMPLES_STR_SIZE]; /* Get setted currency unit */ - SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYSYMBOL), - WM_GETTEXT, - (WPARAM)MAX_SAMPLES_STR_SIZE, - (LPARAM)(LPCSTR)wszCurrencyUnit); + SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYSYMBOL), + WM_GETTEXT, + (WPARAM)MAX_SAMPLES_STR_SIZE, + (LPARAM)(LPCSTR)szCurrencyUnit); /* Save currency unit */ - SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SCURRENCY, wszCurrencyUnit); + SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SCURRENCY, szCurrencyUnit); return TRUE; } @@ -461,48 +458,61 @@ CurrencyPageProc(HWND hwndDlg, switch (uMsg) { case WM_INITDIALOG: - { pGlobalData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(GLOBAL_DATA)); SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pGlobalData); OnInitDialog(hwndDlg, pGlobalData); - } - break; - case WM_COMMAND: - { - switch (LOWORD(wParam)) - { - case IDC_CURRENCYSYMBOL: - case IDC_CURRENCYPOSVALUE: - case IDC_CURRENCYNEGVALUE: - case IDC_CURRENCYDECSEP: - case IDC_CURRENCYDECNUM: - case IDC_CURRENCYGRPSEP: - case IDC_CURRENCYGRPNUM: - if (HIWORD(wParam) == CBN_SELCHANGE || HIWORD(wParam) == CBN_EDITCHANGE) - { - /* Set "Apply" button enabled */ - PropSheet_Changed(GetParent(hwndDlg), hwndDlg); - } - } - } - break; - case WM_NOTIFY: - { - LPNMHDR lpnm = (LPNMHDR)lParam; - /* If push apply button */ - if (lpnm->code == (UINT)PSN_APPLY) - { - if(!SetCurrencyDigNum(hwndDlg)) break; - if(!SetCurrencyUnit(hwndDlg)) break; - if(!SetPosCurrencySumFmt(hwndDlg)) break; - if(!SetNegCurrencySumFmt(hwndDlg)) break; - if(!SetCurrencySep(hwndDlg)) break; - if(!SetCurrencyFracSymNum(hwndDlg)) break; - if(!SetCurrencyFieldSep(hwndDlg)) break; - UpdateExamples(hwndDlg, pGlobalData); - } - } - break; + break; + + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case IDC_CURRENCYSYMBOL: + case IDC_CURRENCYPOSVALUE: + case IDC_CURRENCYNEGVALUE: + case IDC_CURRENCYDECSEP: + case IDC_CURRENCYDECNUM: + case IDC_CURRENCYGRPSEP: + case IDC_CURRENCYGRPNUM: + if (HIWORD(wParam) == CBN_SELCHANGE || HIWORD(wParam) == CBN_EDITCHANGE) + { + /* Set "Apply" button enabled */ + PropSheet_Changed(GetParent(hwndDlg), hwndDlg); + } + } + break; + + case WM_NOTIFY: + { + LPNMHDR lpnm = (LPNMHDR)lParam; + /* If push apply button */ + if (lpnm->code == (UINT)PSN_APPLY) + { + if (!SetCurrencyDigNum(hwndDlg)) + break; + + if (!SetCurrencyUnit(hwndDlg)) + break; + + if (!SetPosCurrencySumFmt(hwndDlg)) + break; + + if (!SetNegCurrencySumFmt(hwndDlg)) + break; + + if (!SetCurrencySep(hwndDlg)) + break; + + if (!SetCurrencyFracSymNum(hwndDlg)) + break; + + if (!SetCurrencyFieldSep(hwndDlg)) + break; + + UpdateExamples(hwndDlg, pGlobalData); + } + } + break; + case WM_DESTROY: HeapFree(GetProcessHeap(), 0, pGlobalData); break; diff --git a/reactos/dll/cpl/intl/date.c b/reactos/dll/cpl/intl/date.c index 57160b33844..fe4bbc60ba0 100644 --- a/reactos/dll/cpl/intl/date.c +++ b/reactos/dll/cpl/intl/date.c @@ -24,23 +24,21 @@ * PROGRAMMER: Eric Kohl */ -#define WINVER 0x0500 - #include #include #include +#include #include "intl.h" #include "resource.h" /* GLOBALS ******************************************************************/ -const INT YEAR_STR_MAX_SIZE=4; -const INT EOLN_SIZE=sizeof(WCHAR); /* size of EOLN char */ +#define YEAR_STR_MAX_SIZE 4 #define MAX_SHORT_FMT_SAMPLES 5 #define MAX_LONG_FMT_SAMPLES 2 #define MAX_SHRT_DATE_SEPARATORS 3 -#define STD_DATE_SEP L"." +#define STD_DATE_SEP _T(".") #define YEAR_DIFF (99) #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 */ BOOL -isDateCompAl(WCHAR walpha) +isDateCompAl(TCHAR alpha) { - - if((walpha == L'y') || (walpha == L'M') || (walpha == L'd') || (walpha == L' ')) return TRUE; - else return FALSE; + if ((alpha == _T('y')) || (alpha == _T('M')) || (alpha == _T('d')) || (alpha == _T(' '))) + return TRUE; + else + return FALSE; } /* Find first date separator in string */ -WCHAR* -FindDateSep(const WCHAR *wszSourceStr) +LPTSTR +FindDateSep(const TCHAR *szSourceStr) { - int nDateCompCount=0; - int nDateSepCount=0; + LPTSTR pszFoundSep; + INT nDateCompCount=0; + INT nDateSepCount=0; - WCHAR* wszFindedSep; - wszFindedSep=(WCHAR*) malloc(MAX_SAMPLES_STR_SIZE*sizeof(WCHAR)); + pszFoundSep = (LPTSTR)malloc(MAX_SAMPLES_STR_SIZE * sizeof(TCHAR)); - wcscpy(wszFindedSep,STD_DATE_SEP); + _tcscpy(pszFoundSep,STD_DATE_SEP); - while(nDateCompCount #include #include - +#include #include #include "intl.h" #include "resource.h" +#define SAMPLE_NUMBER _T("123456789") +#define NO_FLAG 0 + HWND hList; HWND hLocaleList, hGeoList; -BOOL CALLBACK LocalesEnumProc( - LPTSTR lpLocale // locale id -) +BOOL CALLBACK +LocalesEnumProc(LPTSTR lpLocale) { - LCID lcid; - TCHAR lang[255]; - int index; + LCID lcid; + TCHAR lang[255]; + INT index; - //swscanf(lpLocale, L"%lx", &lcid); // maybe use wcstoul? - lcid = wcstoul(lpLocale, NULL, 16); + //swscanf(lpLocale, L"%lx", &lcid); // maybe use wcstoul? + 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, 0, (LPARAM)lang); - SendMessageW(hList, + SendMessage(hList, CB_SETITEMDATA, index, (LPARAM)lcid); - return TRUE; + return TRUE; } /* Update all locale samples */ -static -VOID +static VOID UpdateLocaleSample(HWND hwndDlg, LCID lcidLocale) { - WCHAR OutBuffer[MAX_FMT_SIZE]; + TCHAR OutBuffer[MAX_FMT_SIZE]; /* Get number format sample */ - GetNumberFormatW(lcidLocale, NO_FLAG, SAMPLE_NUMBER, NULL, OutBuffer, + GetNumberFormat(lcidLocale, NO_FLAG, SAMPLE_NUMBER, NULL, OutBuffer, MAX_FMT_SIZE); - SendMessageW(GetDlgItem(hwndDlg, IDC_NUMSAMPLE_EDIT), + SendMessage(GetDlgItem(hwndDlg, IDC_NUMSAMPLE_EDIT), WM_SETTEXT, 0, (LPARAM)OutBuffer); /* 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); - SendMessageW(GetDlgItem(hwndDlg, IDC_MONEYSAMPLE_EDIT), + SendMessage(GetDlgItem(hwndDlg, IDC_MONEYSAMPLE_EDIT), WM_SETTEXT, 0, (LPARAM)OutBuffer); /* Get time format sample */ - GetTimeFormatW(lcidLocale, NO_FLAG, NULL, NULL, OutBuffer, MAX_FMT_SIZE); - SendMessageW(GetDlgItem(hwndDlg, IDC_TIMESAMPLE_EDIT), + GetTimeFormat(lcidLocale, NO_FLAG, NULL, NULL, OutBuffer, MAX_FMT_SIZE); + SendMessage(GetDlgItem(hwndDlg, IDC_TIMESAMPLE_EDIT), WM_SETTEXT, 0, (LPARAM)OutBuffer); /* Get short date format sample */ - GetDateFormatW(lcidLocale, DATE_SHORTDATE, NULL, NULL, OutBuffer, + GetDateFormat(lcidLocale, DATE_SHORTDATE, NULL, NULL, OutBuffer, MAX_FMT_SIZE); - SendMessageW(GetDlgItem(hwndDlg, IDC_SHORTTIMESAMPLE_EDIT), WM_SETTEXT, + SendMessage(GetDlgItem(hwndDlg, IDC_SHORTTIMESAMPLE_EDIT), WM_SETTEXT, 0, (LPARAM)OutBuffer); /* Get long date sample */ - GetDateFormatW(lcidLocale, DATE_LONGDATE, NULL, NULL, OutBuffer, + GetDateFormat(lcidLocale, DATE_LONGDATE, NULL, NULL, OutBuffer, MAX_FMT_SIZE); - SendMessageW(GetDlgItem(hwndDlg, IDC_FULLTIMESAMPLE_EDIT), + SendMessage(GetDlgItem(hwndDlg, IDC_FULLTIMESAMPLE_EDIT), WM_SETTEXT, 0, (LPARAM)OutBuffer); } static VOID CreateLanguagesList(HWND hwnd) { - TCHAR langSel[255]; + TCHAR langSel[255]; - hList = hwnd; - EnumSystemLocalesW(LocalesEnumProc, LCID_SUPPORTED); + hList = hwnd; + EnumSystemLocales(LocalesEnumProc, LCID_SUPPORTED); - // Select current locale - GetLocaleInfo(GetUserDefaultLCID(), LOCALE_SLANGUAGE, langSel, sizeof(langSel)); // or should it be System and not user? - - SendMessageW(hList, + // Select current locale + GetLocaleInfo(GetUserDefaultLCID(), LOCALE_SLANGUAGE, langSel, sizeof(langSel)); // or should it be System and not user? + + SendMessage(hList, CB_SELECTSTRING, -1, (LPARAM)langSel); } // Sets new locale -void SetNewLocale(LCID lcid) +VOID +SetNewLocale(LCID lcid) { // HKCU\\Control Panel\\International\\Locale = 0409 (type=0) // HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","Default",0x00000000,"0409" (type=0) @@ -137,111 +135,113 @@ void SetNewLocale(LCID lcid) DWORD ret; TCHAR value[9]; DWORD valuesize; - WCHAR ACPPage[9]; - WCHAR OEMPage[9]; + TCHAR ACPPage[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) { - 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; } - 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) { - 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; } - ret = RegOpenKeyW(HKEY_CURRENT_USER, L"Control Panel\\International", &localeKey); - + ret = RegOpenKey(HKEY_CURRENT_USER, _T("Control Panel\\International"), &localeKey); if (ret != ERROR_SUCCESS) { // 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; } 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); - 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); + RegSetValueEx(localeKey, _T("Locale"), 0, REG_SZ, (BYTE *)value, valuesize); RegCloseKey(localeKey); // 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) { - 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; } - RegSetValueExW(langKey, L"Default", 0, REG_SZ, (BYTE *)value, valuesize ); - RegSetValueExW(langKey, L"InstallLanguage", 0, REG_SZ, (BYTE *)value, valuesize ); + RegSetValueEx(langKey, _T("Default"), 0, REG_SZ, (BYTE *)value, valuesize ); + RegSetValueEx(langKey, _T("InstallLanguage"), 0, REG_SZ, (BYTE *)value, valuesize ); RegCloseKey(langKey); - // Set language - ret = RegOpenKeyW(HKEY_LOCAL_MACHINE, L"SYSTEM\\CurrentControlSet\\Control\\NLS\\CodePage", &langKey); - + /* Set language */ + ret = RegOpenKey(HKEY_LOCAL_MACHINE, _T("SYSTEM\\CurrentControlSet\\Control\\NLS\\CodePage"), &langKey); 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; } - RegSetValueExW(langKey, L"OEMCP", 0, REG_SZ, (BYTE *)OEMPage, (wcslen(OEMPage) +1 ) * sizeof(WCHAR) ); - RegSetValueExW(langKey, L"ACP", 0, REG_SZ, (BYTE *)ACPPage, (wcslen(ACPPage) +1 ) * sizeof(WCHAR) ); + RegSetValueExW(langKey, _T("OEMCP"), 0, REG_SZ, (BYTE *)OEMPage, (_tcslen(OEMPage) +1 ) * sizeof(TCHAR)); + RegSetValueExW(langKey, _T("ACP"), 0, REG_SZ, (BYTE *)ACPPage, (_tcslen(ACPPage) +1 ) * sizeof(TCHAR)); RegCloseKey(langKey); - } /* Location enumerate procedure */ +#if 0 BOOL CALLBACK LocationsEnumProc(GEOID gId) { TCHAR loc[MAX_STR_SIZE]; - int index; + INT index; GetGeoInfo(gId, GEO_FRIENDLYNAME, loc, MAX_FMT_SIZE, LANG_SYSTEM_DEFAULT); - index = (int) SendMessageW(hGeoList, - CB_ADDSTRING, - 0, - (LPARAM)loc); + index = (INT)SendMessage(hGeoList, + CB_ADDSTRING, + 0, + (LPARAM)loc); - SendMessageW(hGeoList, - CB_SETITEMDATA, - index, - (LPARAM)gId); + SendMessage(hGeoList, + CB_SETITEMDATA, + index, + (LPARAM)gId); return TRUE; } +#endif /* Enumerate all system locations identifiers */ static VOID CreateLocationsList(HWND hWnd) { +#if 0 GEOID userGeoID; TCHAR loc[MAX_STR_SIZE]; @@ -257,16 +257,18 @@ CreateLocationsList(HWND hWnd) MAX_FMT_SIZE, LANG_SYSTEM_DEFAULT); - SendMessageW(hGeoList, + SendMessage(hGeoList, CB_SELECTSTRING, (WPARAM) -1, (LPARAM)loc); +#endif } DWORD VerifyUnattendLCID(HWND hwndDlg) { - LRESULT lCount, lIndex, lResult; + LRESULT lCount, lIndex, lResult; + lCount = SendMessage(hList, CB_GETCOUNT, (WPARAM)0, (LPARAM)0); if (lCount == CB_ERR) { @@ -340,22 +342,21 @@ GeneralPageProc(HWND hwndDlg, int iCurSel; // Acquire new value - iCurSel = SendMessageW(hList, + iCurSel = SendMessage(hList, CB_GETCURSEL, 0, 0); if (iCurSel == CB_ERR) break; - NewLcid = SendMessageW(hList, + NewLcid = SendMessage(hList, CB_GETITEMDATA, iCurSel, 0); if (NewLcid == (LCID)CB_ERR) break; - - + // Actually set new locale SetNewLocale(NewLcid); } diff --git a/reactos/dll/cpl/intl/inplocale.c b/reactos/dll/cpl/intl/inplocale.c index 3e20dac67e5..03a9482c4c9 100644 --- a/reactos/dll/cpl/intl/inplocale.c +++ b/reactos/dll/cpl/intl/inplocale.c @@ -36,16 +36,16 @@ /* Property page dialog callback */ INT_PTR CALLBACK InpLocalePageProc(HWND hwndDlg, - UINT uMsg, - WPARAM wParam, - LPARAM lParam) + UINT uMsg, + WPARAM wParam, + LPARAM lParam) { - switch(uMsg) - { - case WM_INITDIALOG: - break; - } - return FALSE; + switch (uMsg) + { + case WM_INITDIALOG: + break; + } + return FALSE; } /* EOF */ diff --git a/reactos/dll/cpl/intl/intl.c b/reactos/dll/cpl/intl/intl.c index f7f6a9f62e0..8bddcc1bf22 100644 --- a/reactos/dll/cpl/intl/intl.c +++ b/reactos/dll/cpl/intl/intl.c @@ -64,14 +64,14 @@ InitPropSheetPage(PROPSHEETPAGE *psp, WORD idDlg, DLGPROC DlgProc) } BOOL -OpenSetupInf() +OpenSetupInf(VOID) { LPTSTR lpCmdLine; LPTSTR lpSwitch; size_t len; lpCmdLine = GetCommandLine(); - + lpSwitch = _tcsstr(lpCmdLine, _T("/f:\"")); if(!lpSwitch) @@ -101,7 +101,7 @@ OpenSetupInf() } VOID -ParseSetupInf() +ParseSetupInf(VOID) { INFCONTEXT InfContext; TCHAR szBuffer[30]; diff --git a/reactos/dll/cpl/intl/intl.h b/reactos/dll/cpl/intl/intl.h index 5949c4ecfff..11de0c2a8e6 100644 --- a/reactos/dll/cpl/intl/intl.h +++ b/reactos/dll/cpl/intl/intl.h @@ -82,11 +82,11 @@ TimePageProc(HWND hwndDlg, void SetNewLocale(LCID lcid); /* misc.c */ -WCHAR* -InsSpacesFmt(const WCHAR *wszSourceStr, const WCHAR *wszFmtStr); +LPTSTR +InsSpacesFmt(LPCTSTR szSourceStr, LPCTSTR szFmtStr); -WCHAR* -ReplaceSubStr(const WCHAR *wszSourceStr, const WCHAR *wszStrToReplace, const WCHAR *wszTempl); +LPTSTR +ReplaceSubStr(LPCTSTR szSourceStr, LPCTSTR szStrToReplace, LPCTSTR szTempl); LONG APIENTRY diff --git a/reactos/dll/cpl/intl/intl.rbuild b/reactos/dll/cpl/intl/intl.rbuild index 41d4ee6f6a6..e65b466f108 100644 --- a/reactos/dll/cpl/intl/intl.rbuild +++ b/reactos/dll/cpl/intl/intl.rbuild @@ -1,12 +1,11 @@ - + . - - 0x600 - 0x501 + 0x600 + 0x609 kernel32 user32 comctl32 diff --git a/reactos/dll/cpl/intl/languages.c b/reactos/dll/cpl/intl/languages.c index c8fbd245deb..17dba22f605 100644 --- a/reactos/dll/cpl/intl/languages.c +++ b/reactos/dll/cpl/intl/languages.c @@ -1,6 +1,7 @@ #include #include #include +#include #include "intl.h" #include "resource.h" @@ -8,41 +9,44 @@ /* Property page dialog callback */ INT_PTR CALLBACK LanguagesPageProc(HWND hwndDlg, - UINT uMsg, - WPARAM wParam, - LPARAM lParam) + UINT uMsg, + WPARAM wParam, + LPARAM lParam) { - SHELLEXECUTEINFOW shInputDll; - switch(uMsg) - { - case WM_INITDIALOG: - break; - case WM_COMMAND: - switch (LOWORD(wParam)) - { - /* If "detail" button pressed */ - case IDC_DETAIL_BUTTON: - if(HIWORD(wParam)==BN_CLICKED) - { - memset(&shInputDll, 0x0, sizeof(SHELLEXECUTEINFOW)); - 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) + SHELLEXECUTEINFO shInputDll; + + switch (uMsg) + { + case WM_INITDIALOG: + break; + + case WM_COMMAND: + switch (LOWORD(wParam)) + { + /* If "detail" button pressed */ + case IDC_DETAIL_BUTTON: + if (HIWORD(wParam) == BN_CLICKED) { - 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; - } - - - break; - } - return FALSE; + return FALSE; } /* EOF */ diff --git a/reactos/dll/cpl/intl/misc.c b/reactos/dll/cpl/intl/misc.c index 53854249664..f94aedb7558 100644 --- a/reactos/dll/cpl/intl/misc.c +++ b/reactos/dll/cpl/intl/misc.c @@ -1,6 +1,7 @@ #include #include #include +#include #include "intl.h" #include "resource.h" @@ -8,139 +9,141 @@ #define NUM_SHEETS 4 /* Insert the space */ -WCHAR* -InsSpacePos(const WCHAR *wszInsStr, const int nPos) +LPTSTR +InsSpacePos(LPCTSTR szInsStr, const int nPos) { - WCHAR* pwszDestStr; - pwszDestStr=(WCHAR*) malloc(MAX_SAMPLES_STR_SIZE); - - int nDestStrCnt=0; - int nStrCnt; - int nStrSize; + LPTSTR pszDestStr; + INT nDestStrCnt = 0; + INT nStrCnt; + INT nStrSize; - wcscpy(pwszDestStr,wszInsStr); - - nStrSize = wcslen(wszInsStr); + pszDestStr = (LPTSTR)malloc(MAX_SAMPLES_STR_SIZE * sizeof(TCHAR)); - for(nStrCnt=0; nStrCnt #include #include +#include #include "intl.h" #include "resource.h" -#define SAMPLE_NUMBER L"123456789" -#define SAMPLE_NEG_NUMBER L"-123456789" +#define SAMPLE_NUMBER _T("123456789") +#define SAMPLE_NEG_NUMBER _T("-123456789") #define MAX_NUM_SEP_SAMPLES 2 #define MAX_FRAC_NUM_SAMPLES 9 #define MAX_FIELD_SEP_SAMPLES 1 @@ -42,466 +43,432 @@ #define MAX_LEAD_ZEROES_SAMPLES 2 #define MAX_LIST_SEP_SAMPLES 1 #define MAX_UNITS_SYS_SAMPLES 2 -#define EOLN_SIZE sizeof(WCHAR) /* Init num decimal separator control box */ -VOID +static VOID InitNumDecimalSepCB(HWND hwndDlg) { - WCHAR wszNumSepSamples[MAX_NUM_SEP_SAMPLES][MAX_SAMPLES_STR_SIZE]= - { - L",", - L"." - }; - - int nCBIndex; - int nRetCode; - - DWORD dwValueSize=MAX_SAMPLES_STR_SIZE*sizeof(WCHAR)+EOLN_SIZE; - WCHAR wszNumSep[MAX_SAMPLES_STR_SIZE]; + LPTSTR lpNumSepSamples[MAX_NUM_SEP_SAMPLES] = {_T(","), _T(".")}; + TCHAR szNumSep[MAX_SAMPLES_STR_SIZE]; + INT nCBIndex; + INT nRetCode; /* Get current decimal separator */ - GetLocaleInfoW(LOCALE_USER_DEFAULT, - LOCALE_SDECIMAL, - wszNumSep, - dwValueSize); + GetLocaleInfo(LOCALE_USER_DEFAULT, + LOCALE_SDECIMAL, + szNumSep, + MAX_SAMPLES_STR_SIZE); /* Clear all box content */ - SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERDSYMBOL), - CB_RESETCONTENT, - (WPARAM)0, - (LPARAM)0); + SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERDSYMBOL), + CB_RESETCONTENT, + (WPARAM)0, + (LPARAM)0); - /* Create standart list of decimal separators */ - for(nCBIndex=0;nCBIndexcode == (UINT)PSN_APPLY) { if(!SetNumDecimalSep(hwndDlg)) break; - if(!SetFracSymNum(hwndDlg)) break; - if(!SetNumFieldSep(hwndDlg)) break; - if(!SetFieldDigNum(hwndDlg)) break; - if(!SetNumNegSign(hwndDlg)) break; - if(!SetNegSumFmt(hwndDlg)) break; - if(!SetNumLeadZero(hwndDlg)) break; - if(!SetNumListSep(hwndDlg)) break; - if(!SetNumUnitsSys(hwndDlg)) break; + if (!SetFracSymNum(hwndDlg)) break; + if (!SetNumFieldSep(hwndDlg)) break; + if (!SetFieldDigNum(hwndDlg)) break; + if (!SetNumNegSign(hwndDlg)) break; + if (!SetNegSumFmt(hwndDlg)) break; + if (!SetNumLeadZero(hwndDlg)) break; + if (!SetNumListSep(hwndDlg)) break; + if (!SetNumUnitsSys(hwndDlg)) break; UpdateNumSamples(hwndDlg, LOCALE_USER_DEFAULT); } diff --git a/reactos/dll/cpl/intl/setupreg.c b/reactos/dll/cpl/intl/setupreg.c index 4ec564ffd19..ae85e94c948 100644 --- a/reactos/dll/cpl/intl/setupreg.c +++ b/reactos/dll/cpl/intl/setupreg.c @@ -5,12 +5,13 @@ * PURPOSE: ReactOS International Control Panel * PROGRAMMERS: Alexey Zavyalov (gen_x@mail.ru) */ - + /* INCLUDES *****************************************************************/ #include #include #include +#include #include "intl.h" #include "resource.h" @@ -22,139 +23,140 @@ /* FUNCTIONS ****************************************************************/ /* Insert the space */ -WCHAR* -InsSpacePos(const WCHAR *wszInsStr, const int nPos) +TCHAR* +InsSpacePos(const TCHAR *szInsStr, const int nPos) { - WCHAR* pwszDestStr; - pwszDestStr=(WCHAR*) malloc(MAX_SAMPLES_STR_SIZE); - + LPTSTR pszDestStr; int nDestStrCnt=0; int nStrCnt; int nStrSize; - wcscpy(pwszDestStr,wszInsStr); - - nStrSize = wcslen(wszInsStr); + pszDestStr = (LPTSTR)malloc(MAX_SAMPLES_STR_SIZE * sizeof(TCHAR)); - for(nStrCnt=0; nStrCnt #include #include +#include #include "intl.h" #include "resource.h" /* * TODO: - * - Enumerate available time formats (use EnumTimeformatsW) + * - Enumerate available time formats (use EnumTimeFormats) */ static VOID UpdateTimeSample(HWND hWnd) { - WCHAR InBuffer[80]; - WCHAR OutBuffer[80]; + TCHAR InBuffer[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, LPARAM lParam) { - switch(uMsg) + switch (uMsg) { case WM_INITDIALOG: { - WCHAR Buffer[80]; + TCHAR Buffer[80]; int nLen; /* Update the time format sample */ UpdateTimeSample(GetDlgItem(hwndDlg, IDC_TIMESAMPLE)); /* Get the time format (max. 80 characters) */ - SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEFORMAT), + SendMessage(GetDlgItem(hwndDlg, IDC_TIMEFORMAT), CB_LIMITTEXT, 80, 0); /* FIXME: add available time formats to the list */ - GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_STIMEFORMAT, Buffer, 80); - SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEFORMAT), - CB_ADDSTRING, - 0, - (LPARAM)Buffer); - SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEFORMAT), + GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_STIMEFORMAT, Buffer, 80); + SendMessage(GetDlgItem(hwndDlg, IDC_TIMEFORMAT), + CB_ADDSTRING, + 0, + (LPARAM)Buffer); + SendMessage(GetDlgItem(hwndDlg, IDC_TIMEFORMAT), CB_SETCURSEL, 0, /* index */ 0); /* Get the time separator (max. 4 characters) */ - SendMessageW(GetDlgItem(hwndDlg, IDC_TIMESEPARATOR), + SendMessage(GetDlgItem(hwndDlg, IDC_TIMESEPARATOR), CB_LIMITTEXT, 4, 0); - GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_STIME, Buffer, 80); - SendMessageW(GetDlgItem(hwndDlg, IDC_TIMESEPARATOR), - CB_ADDSTRING, - 0, - (LPARAM)Buffer); - SendMessageW(GetDlgItem(hwndDlg, IDC_TIMESEPARATOR), + GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_STIME, Buffer, 80); + SendMessage(GetDlgItem(hwndDlg, IDC_TIMESEPARATOR), + CB_ADDSTRING, + 0, + (LPARAM)Buffer); + SendMessage(GetDlgItem(hwndDlg, IDC_TIMESEPARATOR), CB_SETCURSEL, 0, /* index */ 0); /* Get the AM symbol (max. 9 characters) */ - SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEAMSYMBOL), + SendMessage(GetDlgItem(hwndDlg, IDC_TIMEAMSYMBOL), CB_LIMITTEXT, 9, 0); - nLen = GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_S1159, Buffer, 80); - SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEAMSYMBOL), - CB_ADDSTRING, - 0, - (LPARAM)Buffer); + nLen = GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_S1159, Buffer, 80); + SendMessage(GetDlgItem(hwndDlg, IDC_TIMEAMSYMBOL), + CB_ADDSTRING, + 0, + (LPARAM)Buffer); if (nLen != 0) { - SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEAMSYMBOL), - CB_ADDSTRING, - 0, - (LPARAM)L""); + SendMessage(GetDlgItem(hwndDlg, IDC_TIMEAMSYMBOL), + CB_ADDSTRING, + 0, + (LPARAM)_T("")); } - SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEAMSYMBOL), + SendMessage(GetDlgItem(hwndDlg, IDC_TIMEAMSYMBOL), CB_SETCURSEL, 0, /* index */ 0); /* Get the PM symbol (max. 9 characters) */ - SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEPMSYMBOL), + SendMessage(GetDlgItem(hwndDlg, IDC_TIMEPMSYMBOL), CB_LIMITTEXT, 9, 0); - nLen = GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_S2359, Buffer, 80); - SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEPMSYMBOL), - CB_ADDSTRING, - 0, - (LPARAM)Buffer); + nLen = GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_S2359, Buffer, 80); + SendMessage(GetDlgItem(hwndDlg, IDC_TIMEPMSYMBOL), + CB_ADDSTRING, + 0, + (LPARAM)Buffer); if (nLen != 0) { - SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEPMSYMBOL), - CB_ADDSTRING, - 0, - (LPARAM)L""); + SendMessage(GetDlgItem(hwndDlg, IDC_TIMEPMSYMBOL), + CB_ADDSTRING, + 0, + (LPARAM)_T("")); } - SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEPMSYMBOL), + SendMessage(GetDlgItem(hwndDlg, IDC_TIMEPMSYMBOL), CB_SETCURSEL, 0, /* index */ 0); @@ -159,49 +160,49 @@ TimePageProc(HWND hwndDlg, if (lpnm->code == (UINT)PSN_APPLY) { - WCHAR Buffer[80]; + TCHAR Buffer[80]; int nIndex; /* Set time format */ - nIndex = SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEFORMAT), + nIndex = SendMessage(GetDlgItem(hwndDlg, IDC_TIMEFORMAT), CB_GETCURSEL, 0, 0); - SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEFORMAT), + SendMessage(GetDlgItem(hwndDlg, IDC_TIMEFORMAT), CB_GETLBTEXT, (WPARAM)nIndex, (LPARAM)Buffer); - SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_STIMEFORMAT, Buffer); + SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_STIMEFORMAT, Buffer); /* Set time separator */ - nIndex = SendMessageW(GetDlgItem(hwndDlg, IDC_TIMESEPARATOR), + nIndex = SendMessage(GetDlgItem(hwndDlg, IDC_TIMESEPARATOR), CB_GETCURSEL, 0, 0); - SendMessageW(GetDlgItem(hwndDlg, IDC_TIMESEPARATOR), + SendMessage(GetDlgItem(hwndDlg, IDC_TIMESEPARATOR), CB_GETLBTEXT, (WPARAM)nIndex, (LPARAM)Buffer); - SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_STIME, Buffer); + SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_STIME, Buffer); /* Set the AM symbol */ - nIndex = SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEAMSYMBOL), + nIndex = SendMessage(GetDlgItem(hwndDlg, IDC_TIMEAMSYMBOL), CB_GETCURSEL, 0, 0); if (nIndex != CB_ERR) { - SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEAMSYMBOL), + SendMessage(GetDlgItem(hwndDlg, IDC_TIMEAMSYMBOL), CB_GETLBTEXT, (WPARAM)nIndex, (LPARAM)Buffer); - SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_S1159, Buffer); + SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_S1159, Buffer); } else { - SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_S1159, L""); + SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_S1159, _T("")); } /* Set the PM symbol */ - nIndex = SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEPMSYMBOL), + nIndex = SendMessage(GetDlgItem(hwndDlg, IDC_TIMEPMSYMBOL), CB_GETCURSEL, 0, 0); if (nIndex != CB_ERR) { - SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEPMSYMBOL), + SendMessage(GetDlgItem(hwndDlg, IDC_TIMEPMSYMBOL), CB_GETLBTEXT, (WPARAM)nIndex, (LPARAM)Buffer); - SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_S2359, Buffer); + SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_S2359, Buffer); } else { - SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_S2359, L""); + SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_S2359, _T("")); } /* Update the time format sample */