3 /////////////////////////////////////////////////////////////////////////////
5 // Copyright (c) 2002 Iain Murray
7 /////////////////////////////////////////////////////////////////////////////
11 #include "WinLocalisation.h"
13 // Track memory leaks on Windows to the line that new'd the memory
16 #define DEBUG_NEW new( _NORMAL_BLOCK, THIS_FILE, __LINE__ )
19 static char THIS_FILE
[] = __FILE__
;
23 UINT
WinLocalisation::GetUserCodePage() {
24 // Pity this is for the system, not the user:
27 TCHAR CharCodePage
[7];
28 GetLocaleInfo(LOCALE_USER_DEFAULT
, LOCALE_IDEFAULTANSICODEPAGE
, CharCodePage
, 7);
30 return _ttoi(CharCodePage
);
33 // // Could get name and other useful stuff about current codepage:
35 // GetCPInfoEx(CurrentCodePage, 0, &CPInfoEx);
36 // // This Doesn't work in Win95 though...
38 HFONT
WinLocalisation::GetCodePageFont(UINT CodePage
, LONG Height
) {
39 CHARSETINFO CharsetInfo
;
41 if(TranslateCharsetInfo((DWORD FAR
*) CodePage
, &CharsetInfo
, TCI_SRCCODEPAGE
)) {
42 MyCharset
= CharsetInfo
.ciCharset
;
45 MyCharset
= DEFAULT_CHARSET
;
47 return CreateFont(Height
, 0, 0, 0, FW_DONTCARE
, FALSE
, FALSE
, FALSE
, MyCharset
, // Apart from the character set and size I don't care about the font.
48 OUT_DEFAULT_PRECIS
, CLIP_DEFAULT_PRECIS
, DEFAULT_QUALITY
, FF_DONTCARE
, NULL
);
51 void WinLocalisation::GetResourceString(UINT ResourceID
, Tstring
*ResourceString
) {
52 const unsigned int MAX_LOADSTRING
= 100;
53 TCHAR szTitle
[MAX_LOADSTRING
];
54 LoadString(WinHelper::hInstApp
, ResourceID
, szTitle
, MAX_LOADSTRING
);
55 *ResourceString
= szTitle
;