convert to unicode in an attempt to address bug 2805

svn path=/trunk/; revision=30289
This commit is contained in:
Ged Murphy 2007-11-09 11:40:54 +00:00
parent d63772135f
commit 6d45e894ef
5 changed files with 219 additions and 203 deletions

View file

@ -24,30 +24,34 @@ AboutDialogProc(HWND hDlg,
case WM_INITDIALOG: case WM_INITDIALOG:
{ {
HWND hLicenseEditWnd; HWND hLicenseEditWnd;
TCHAR strLicense[700]; WCHAR strLicense[700];
hIcon = LoadImage(hInstance, hIcon = LoadImageW(hInstance,
MAKEINTRESOURCE(IDI_ICON), MAKEINTRESOURCEW(IDI_ICON),
IMAGE_ICON, IMAGE_ICON,
16, 16,
16, 16,
0); 0);
if (hIcon)
SendMessage(hDlg, {
WM_SETICON, SendMessage(hDlg,
ICON_SMALL, WM_SETICON,
(LPARAM)hIcon); ICON_SMALL,
(LPARAM)hIcon);
}
hLicenseEditWnd = GetDlgItem(hDlg, hLicenseEditWnd = GetDlgItem(hDlg,
IDC_LICENSE_EDIT); IDC_LICENSE_EDIT);
LoadString(hInstance, if (LoadStringW(hInstance,
IDS_LICENSE, IDS_LICENSE,
strLicense, strLicense,
sizeof(strLicense) / sizeof(TCHAR)); sizeof(strLicense) / sizeof(WCHAR)))
{
SetWindowTextW(hLicenseEditWnd,
strLicense);
}
SetWindowText(hLicenseEditWnd,
strLicense);
return TRUE; return TRUE;
} }
@ -72,8 +76,8 @@ AboutDialogProc(HWND hDlg,
VOID VOID
ShowAboutDlg(HWND hWndParent) ShowAboutDlg(HWND hWndParent)
{ {
DialogBox(hInstance, DialogBoxW(hInstance,
MAKEINTRESOURCE(IDD_ABOUTBOX), MAKEINTRESOURCEW(IDD_ABOUTBOX),
hWndParent, hWndParent,
AboutDialogProc); AboutDialogProc);
} }

View file

@ -15,39 +15,39 @@ HINSTANCE hInstance;
/* Font-enumeration callback */ /* Font-enumeration callback */
static int CALLBACK static int CALLBACK
EnumFontNames(ENUMLOGFONTEX *lpelfe, EnumFontNames(ENUMLOGFONTEXW *lpelfe,
NEWTEXTMETRICEX *lpntme, NEWTEXTMETRICEXW *lpntme,
DWORD FontType, DWORD FontType,
LPARAM lParam) LPARAM lParam)
{ {
HWND hwndCombo = (HWND)lParam; HWND hwndCombo = (HWND)lParam;
TCHAR *pszName = lpelfe->elfLogFont.lfFaceName; LPWSTR pszName = lpelfe->elfLogFont.lfFaceName;
/* make sure font doesn't already exist in our list */ /* make sure font doesn't already exist in our list */
if(SendMessage(hwndCombo, if(SendMessageW(hwndCombo,
CB_FINDSTRING, CB_FINDSTRING,
0, 0,
(LPARAM)pszName) == CB_ERR) (LPARAM)pszName) == CB_ERR)
{ {
INT idx; INT idx;
BOOL fFixed; BOOL fFixed;
BOOL fTrueType; BOOL fTrueType;
/* add the font */ /* add the font */
idx = (INT)SendMessage(hwndCombo, idx = (INT)SendMessageW(hwndCombo,
CB_ADDSTRING, CB_ADDSTRING,
0, 0,
(LPARAM)pszName); (LPARAM)pszName);
/* record the font's attributes (Fixedwidth and Truetype) */ /* record the font's attributes (Fixedwidth and Truetype) */
fFixed = (lpelfe->elfLogFont.lfPitchAndFamily & FIXED_PITCH) ? TRUE : FALSE; fFixed = (lpelfe->elfLogFont.lfPitchAndFamily & FIXED_PITCH) ? TRUE : FALSE;
fTrueType = (lpelfe->elfLogFont.lfOutPrecision == OUT_STROKE_PRECIS) ? TRUE : FALSE; fTrueType = (lpelfe->elfLogFont.lfOutPrecision == OUT_STROKE_PRECIS) ? TRUE : FALSE;
/* store this information in the list-item's userdata area */ /* store this information in the list-item's userdata area */
SendMessage(hwndCombo, SendMessageW(hwndCombo,
CB_SETITEMDATA, CB_SETITEMDATA,
idx, idx,
MAKEWPARAM(fFixed, fTrueType)); MAKEWPARAM(fFixed, fTrueType));
} }
return 1; return 1;
@ -59,35 +59,35 @@ static VOID
FillFontStyleComboList(HWND hwndCombo) FillFontStyleComboList(HWND hwndCombo)
{ {
HDC hdc; HDC hdc;
LOGFONT lf; LOGFONTW lf;
/* FIXME: for fun, draw each font in its own style */ /* FIXME: for fun, draw each font in its own style */
HFONT hFont = GetStockObject(DEFAULT_GUI_FONT); HFONT hFont = GetStockObject(DEFAULT_GUI_FONT);
SendMessage(hwndCombo, SendMessageW(hwndCombo,
WM_SETFONT, WM_SETFONT,
(WPARAM)hFont, (WPARAM)hFont,
0); 0);
lf.lfCharSet = DEFAULT_CHARSET; lf.lfCharSet = DEFAULT_CHARSET;
lf.lfFaceName[0] = _T('\0'); // all fonts lf.lfFaceName[0] = L'\0'; // all fonts
lf.lfPitchAndFamily = 0; lf.lfPitchAndFamily = 0;
hdc = GetDC(hwndCombo); hdc = GetDC(hwndCombo);
/* store the list of fonts in the combo */ /* store the list of fonts in the combo */
EnumFontFamiliesEx(hdc, EnumFontFamiliesExW(hdc,
&lf, &lf,
(FONTENUMPROC)EnumFontNames, (FONTENUMPROCW)EnumFontNames,
(LPARAM)hwndCombo, (LPARAM)hwndCombo,
0); 0);
ReleaseDC(hwndCombo, ReleaseDC(hwndCombo,
hdc); hdc);
SendMessage(hwndCombo, SendMessageW(hwndCombo,
CB_SETCURSEL, CB_SETCURSEL,
0, 0,
0); 0);
} }
@ -96,12 +96,12 @@ ChangeMapFont(HWND hDlg)
{ {
HWND hCombo; HWND hCombo;
HWND hMap; HWND hMap;
LPTSTR lpFontName; LPWSTR lpFontName;
INT Len; INT Len;
hCombo = GetDlgItem(hDlg, IDC_FONTCOMBO); hCombo = GetDlgItem(hDlg, IDC_FONTCOMBO);
Len = GetWindowTextLength(hCombo); Len = GetWindowTextLengthW(hCombo);
if (Len != 0) if (Len != 0)
{ {
@ -111,17 +111,17 @@ ChangeMapFont(HWND hDlg)
if (lpFontName) if (lpFontName)
{ {
SendMessage(hCombo, SendMessageW(hCombo,
WM_GETTEXT, WM_GETTEXT,
Len + 1, Len + 1,
(LPARAM)lpFontName); (LPARAM)lpFontName);
hMap = GetDlgItem(hDlg, IDC_FONTMAP); hMap = GetDlgItem(hDlg, IDC_FONTMAP);
SendMessage(hMap, SendMessageW(hMap,
FM_SETFONT, FM_SETFONT,
0, 0,
(LPARAM)lpFontName); (LPARAM)lpFontName);
} }
} }
} }
@ -129,9 +129,9 @@ ChangeMapFont(HWND hDlg)
static VOID static VOID
AddCharToSelection(HWND hText, AddCharToSelection(HWND hText,
TCHAR ch) WCHAR ch)
{ {
LPTSTR lpText; LPWSTR lpText;
INT Len = GetWindowTextLength(hText); INT Len = GetWindowTextLength(hText);
if (Len != 0) if (Len != 0)
@ -142,22 +142,22 @@ AddCharToSelection(HWND hText,
if (lpText) if (lpText)
{ {
LPTSTR lpStr = lpText; LPWSTR lpStr = lpText;
SendMessage(hText, SendMessageW(hText,
WM_GETTEXT, WM_GETTEXT,
Len + 1, Len + 1,
(LPARAM)lpStr); (LPARAM)lpStr);
lpStr += Len; lpStr += Len;
*lpStr = ch; *lpStr = ch;
lpStr++; lpStr++;
*lpStr = _T('\0'); *lpStr = L'\0';
SendMessage(hText, SendMessageW(hText,
WM_SETTEXT, WM_SETTEXT,
0, 0,
(LPARAM)lpText); (LPARAM)lpText);
HeapFree(GetProcessHeap(), HeapFree(GetProcessHeap(),
0, 0,
@ -166,15 +166,15 @@ AddCharToSelection(HWND hText,
} }
else else
{ {
TCHAR szText[2]; WCHAR szText[2];
szText[0] = ch; szText[0] = ch;
szText[1] = _T('\0'); szText[1] = L'\0';
SendMessage(hText, SendMessageW(hText,
WM_SETTEXT, WM_SETTEXT,
0, 0,
(LPARAM)szText); (LPARAM)szText);
} }
} }
@ -185,35 +185,42 @@ DlgProc(HWND hDlg,
WPARAM wParam, WPARAM wParam,
LPARAM lParam) LPARAM lParam)
{ {
static HICON hSmIcon;
static HICON hBgIcon;
switch(Message) switch(Message)
{ {
case WM_INITDIALOG: case WM_INITDIALOG:
{ {
HICON hSmIcon;
HICON hBgIcon;
HMENU hSysMenu; HMENU hSysMenu;
hSmIcon = LoadImage(hInstance, hSmIcon = LoadImageW(hInstance,
MAKEINTRESOURCE(IDI_ICON), MAKEINTRESOURCEW(IDI_ICON),
IMAGE_ICON, IMAGE_ICON,
16, 16,
16, 16,
0); 0);
hBgIcon = LoadImage(hInstance, if (hSmIcon)
MAKEINTRESOURCE(IDI_ICON), {
IMAGE_ICON, SendMessageW(hDlg,
32, WM_SETICON,
32, ICON_SMALL,
0); (LPARAM)hSmIcon);
}
SendMessage(hDlg, hBgIcon = LoadImageW(hInstance,
WM_SETICON, MAKEINTRESOURCEW(IDI_ICON),
ICON_SMALL, IMAGE_ICON,
(LPARAM)hSmIcon); 32,
SendMessage(hDlg, 32,
WM_SETICON, 0);
ICON_BIG, if (hBgIcon)
(LPARAM)hBgIcon); {
SendMessageW(hDlg,
WM_SETICON,
ICON_BIG,
(LPARAM)hBgIcon);
}
FillFontStyleComboList(GetDlgItem(hDlg, FillFontStyleComboList(GetDlgItem(hDlg,
IDC_FONTCOMBO)); IDC_FONTCOMBO));
@ -224,33 +231,27 @@ DlgProc(HWND hDlg,
FALSE); FALSE);
if (hSysMenu != NULL) if (hSysMenu != NULL)
{ {
LPCTSTR lpAboutText = NULL; LPCWSTR lpAboutText = NULL;
if (LoadString(hInstance, if (LoadStringW(hInstance,
IDS_ABOUT, IDS_ABOUT,
(LPTSTR)&lpAboutText, (LPWSTR)&lpAboutText,
0)) 0))
{ {
AppendMenu(hSysMenu, AppendMenuW(hSysMenu,
MF_SEPARATOR, MF_SEPARATOR,
0, 0,
NULL); NULL);
AppendMenu(hSysMenu, AppendMenuW(hSysMenu,
MF_STRING, MF_STRING,
ID_ABOUT, ID_ABOUT,
lpAboutText); lpAboutText);
} }
} }
return TRUE; return TRUE;
} }
break; break;
case WM_CLOSE:
{
EndDialog(hDlg, 0);
}
break;
case WM_COMMAND: case WM_COMMAND:
{ {
switch(LOWORD(wParam)) switch(LOWORD(wParam))
@ -269,7 +270,7 @@ DlgProc(HWND hDlg,
TCHAR ch; TCHAR ch;
HWND hMap = GetDlgItem(hDlg, IDC_FONTMAP); HWND hMap = GetDlgItem(hDlg, IDC_FONTMAP);
ch = (TCHAR) SendMessage(hMap, FM_GETCHAR, 0, 0); ch = (TCHAR) SendMessageW(hMap, FM_GETCHAR, 0, 0);
if (ch) if (ch)
{ {
@ -281,6 +282,10 @@ DlgProc(HWND hDlg,
} }
case IDOK: case IDOK:
if (hSmIcon)
DestroyIcon(hSmIcon);
if (hBgIcon)
DestroyIcon(hBgIcon);
EndDialog(hDlg, 0); EndDialog(hDlg, 0);
break; break;
} }
@ -321,6 +326,14 @@ DlgProc(HWND hDlg,
} }
break; break;
case WM_CLOSE:
if (hSmIcon)
DestroyIcon(hSmIcon);
if (hBgIcon)
DestroyIcon(hBgIcon);
EndDialog(hDlg, 0);
break;
default: default:
return FALSE; return FALSE;
} }
@ -346,10 +359,10 @@ _tWinMain(HINSTANCE hInst,
if (RegisterMapClasses(hInstance)) if (RegisterMapClasses(hInstance))
{ {
Ret = DialogBox(hInstance, Ret = DialogBoxW(hInstance,
MAKEINTRESOURCE(IDD_CHARMAP), MAKEINTRESOURCEW(IDD_CHARMAP),
NULL, NULL,
(DLGPROC)DlgProc) >= 0; (DLGPROC)DlgProc) >= 0;
UnregisterMapClasses(hInstance); UnregisterMapClasses(hInstance);
} }

View file

@ -13,17 +13,17 @@
static HFONT static HFONT
SetLrgFont(PMAP infoPtr) SetLrgFont(PMAP infoPtr)
{ {
LOGFONT lf; LOGFONTW lf;
HFONT hFont = NULL; HFONT hFont = NULL;
HDC hdc; HDC hdc;
HWND hCombo; HWND hCombo;
LPTSTR lpFontName; LPWSTR lpFontName;
INT Len; INT Len;
hCombo = GetDlgItem(infoPtr->hParent, hCombo = GetDlgItem(infoPtr->hParent,
IDC_FONTCOMBO); IDC_FONTCOMBO);
Len = GetWindowTextLength(hCombo); Len = GetWindowTextLengthW(hCombo);
if (Len != 0) if (Len != 0)
{ {
@ -33,10 +33,10 @@ SetLrgFont(PMAP infoPtr)
if (lpFontName) if (lpFontName)
{ {
SendMessage(hCombo, SendMessageW(hCombo,
WM_GETTEXT, WM_GETTEXT,
31, 31,
(LPARAM)lpFontName); (LPARAM)lpFontName);
ZeroMemory(&lf, ZeroMemory(&lf,
sizeof(lf)); sizeof(lf));
@ -48,10 +48,10 @@ SetLrgFont(PMAP infoPtr)
hdc); hdc);
lf.lfCharSet = DEFAULT_CHARSET; lf.lfCharSet = DEFAULT_CHARSET;
lstrcpy(lf.lfFaceName, wcscpy(lf.lfFaceName,
lpFontName); lpFontName);
hFont = CreateFontIndirect(&lf); hFont = CreateFontIndirectW(&lf);
HeapFree(GetProcessHeap(), HeapFree(GetProcessHeap(),
0, 0,
@ -75,7 +75,7 @@ LrgCellWndProc(HWND hwnd,
static RECT rc; static RECT rc;
static HFONT hFont = NULL; static HFONT hFont = NULL;
infoPtr = (PMAP)GetWindowLongPtr(hwnd, infoPtr = (PMAP)GetWindowLongPtrW(hwnd,
GWLP_USERDATA); GWLP_USERDATA);
if (infoPtr == NULL && uMsg != WM_CREATE) if (infoPtr == NULL && uMsg != WM_CREATE)
@ -87,11 +87,11 @@ LrgCellWndProc(HWND hwnd,
{ {
case WM_CREATE: case WM_CREATE:
{ {
infoPtr = (PMAP)(((LPCREATESTRUCT)lParam)->lpCreateParams); infoPtr = (PMAP)(((LPCREATESTRUCTW)lParam)->lpCreateParams);
SetWindowLongPtr(hwnd, SetWindowLongPtrW(hwnd,
GWLP_USERDATA, GWLP_USERDATA,
(LONG_PTR)infoPtr); (LONG_PTR)infoPtr);
hFont = SetLrgFont(infoPtr); hFont = SetLrgFont(infoPtr);
@ -128,11 +128,11 @@ LrgCellWndProc(HWND hwnd,
hOldFont = SelectObject(hdc, hFont); hOldFont = SelectObject(hdc, hFont);
DrawText(hdc, DrawTextW(hdc,
&infoPtr->pActiveCell->ch, &infoPtr->pActiveCell->ch,
1, 1,
&rc, &rc,
DT_CENTER | DT_VCENTER | DT_SINGLELINE); DT_CENTER | DT_VCENTER | DT_SINGLELINE);
SelectObject(hdc, hOldFont); SelectObject(hdc, hOldFont);
@ -152,10 +152,10 @@ LrgCellWndProc(HWND hwnd,
default: default:
{ {
HandleDefaultMessage: HandleDefaultMessage:
Ret = DefWindowProc(hwnd, Ret = DefWindowProcW(hwnd,
uMsg, uMsg,
wParam, wParam,
lParam); lParam);
break; break;
} }
} }

View file

@ -9,12 +9,12 @@
#include <precomp.h> #include <precomp.h>
static const TCHAR szMapWndClass[] = TEXT("FontMapWnd"); static const WCHAR szMapWndClass[] = L"FontMapWnd";
static const TCHAR szLrgCellWndClass[] = TEXT("LrgCellWnd"); static const WCHAR szLrgCellWndClass[] = L"LrgCellWnd";
static VOID static VOID
TagFontToCell(PCELL pCell, TagFontToCell(PCELL pCell,
TCHAR ch) WCHAR ch)
{ {
pCell->ch = ch; pCell->ch = ch;
} }
@ -82,7 +82,7 @@ FillGrid(PMAP infoPtr,
HDC hdc) HDC hdc)
{ {
HFONT hOldFont; HFONT hOldFont;
TCHAR ch; WCHAR ch;
INT x, y; INT x, y;
hOldFont = SelectObject(hdc, hOldFont = SelectObject(hdc,
@ -91,15 +91,15 @@ FillGrid(PMAP infoPtr,
for (y = 0; y < YCELLS; y++) for (y = 0; y < YCELLS; y++)
for (x = 0; x < XCELLS; x++) for (x = 0; x < XCELLS; x++)
{ {
ch = (TCHAR)((256 * infoPtr->iPage) + (XCELLS * y) + x); ch = (WCHAR)((256 * infoPtr->iPage) + (XCELLS * y) + x);
TagFontToCell(&infoPtr->Cells[y][x], ch); TagFontToCell(&infoPtr->Cells[y][x], ch);
DrawText(hdc, DrawTextW(hdc,
&ch, &ch,
1, 1,
&infoPtr->Cells[y][x].CellInt, &infoPtr->Cells[y][x].CellInt,
DT_CENTER | DT_VCENTER | DT_SINGLELINE); DT_CENTER | DT_VCENTER | DT_SINGLELINE);
} }
SelectObject(hdc, SelectObject(hdc,
@ -124,18 +124,18 @@ CreateLargeCell(PMAP infoPtr)
XLARGE - XCELLS, XLARGE - XCELLS,
YLARGE - YCELLS); YLARGE - YCELLS);
infoPtr->hLrgWnd = CreateWindowEx(0, infoPtr->hLrgWnd = CreateWindowExW(0,
szLrgCellWndClass, szLrgCellWndClass,
NULL, NULL,
WS_CHILDWINDOW | WS_VISIBLE, WS_CHILDWINDOW | WS_VISIBLE,
rLarge.left, rLarge.left,
rLarge.top, rLarge.top,
rLarge.right - rLarge.left, rLarge.right - rLarge.left,
rLarge.bottom - rLarge.top, rLarge.bottom - rLarge.top,
infoPtr->hParent, infoPtr->hParent,
NULL, NULL,
hInstance, hInstance,
infoPtr); infoPtr);
if (!infoPtr->hLrgWnd) if (!infoPtr->hLrgWnd)
return FALSE; return FALSE;
@ -175,7 +175,7 @@ MoveLargeCell(PMAP infoPtr)
static VOID static VOID
SetFont(PMAP infoPtr, SetFont(PMAP infoPtr,
LPTSTR lpFontName) LPWSTR lpFontName)
{ {
HDC hdc; HDC hdc;
@ -183,7 +183,7 @@ SetFont(PMAP infoPtr,
DeleteObject(infoPtr->hFont); DeleteObject(infoPtr->hFont);
ZeroMemory(&infoPtr->CurrentFont, ZeroMemory(&infoPtr->CurrentFont,
sizeof(LOGFONT)); sizeof(LOGFONTW));
hdc = GetDC(infoPtr->hMapWnd); hdc = GetDC(infoPtr->hMapWnd);
infoPtr->CurrentFont.lfHeight = GetDeviceCaps(hdc, infoPtr->CurrentFont.lfHeight = GetDeviceCaps(hdc,
@ -191,10 +191,10 @@ SetFont(PMAP infoPtr,
ReleaseDC(infoPtr->hMapWnd, hdc); ReleaseDC(infoPtr->hMapWnd, hdc);
infoPtr->CurrentFont.lfCharSet = DEFAULT_CHARSET; infoPtr->CurrentFont.lfCharSet = DEFAULT_CHARSET;
lstrcpy(infoPtr->CurrentFont.lfFaceName, wcscpy(infoPtr->CurrentFont.lfFaceName,
lpFontName); lpFontName);
infoPtr->hFont = CreateFontIndirect(&infoPtr->CurrentFont); infoPtr->hFont = CreateFontIndirectW(&infoPtr->CurrentFont);
InvalidateRect(infoPtr->hMapWnd, InvalidateRect(infoPtr->hMapWnd,
NULL, NULL,
@ -205,7 +205,7 @@ SetFont(PMAP infoPtr,
static LRESULT static LRESULT
NotifyParentOfSelection(PMAP infoPtr, NotifyParentOfSelection(PMAP infoPtr,
UINT code, UINT code,
TCHAR ch) WCHAR ch)
{ {
LRESULT Ret = 0; LRESULT Ret = 0;
@ -311,9 +311,9 @@ OnCreate(PMAP infoPtr,
if (infoPtr) if (infoPtr)
{ {
SetLastError(0); SetLastError(0);
SetWindowLongPtr(hwnd, SetWindowLongPtrW(hwnd,
0, 0,
(DWORD_PTR)infoPtr); (DWORD_PTR)infoPtr);
if (GetLastError() == 0) if (GetLastError() == 0)
{ {
ZeroMemory(infoPtr, ZeroMemory(infoPtr,
@ -375,8 +375,7 @@ OnVScroll(PMAP infoPtr,
} }
infoPtr->iPage = max(0, infoPtr->iPage = max(0,
min(infoPtr->iPage, min(infoPtr->iPage, 255));
255));
SetScrollPos(infoPtr->hMapWnd, SetScrollPos(infoPtr->hMapWnd,
SB_VERT, SB_VERT,
@ -440,8 +439,8 @@ MapWndProc(HWND hwnd,
PMAP infoPtr; PMAP infoPtr;
LRESULT Ret = 0; LRESULT Ret = 0;
infoPtr = (PMAP)GetWindowLongPtr(hwnd, infoPtr = (PMAP)GetWindowLongPtrW(hwnd,
0); 0);
switch (uMsg) switch (uMsg)
{ {
@ -487,7 +486,7 @@ MapWndProc(HWND hwnd,
case FM_SETFONT: case FM_SETFONT:
{ {
LPTSTR lpFontName = (LPTSTR)lParam; LPWSTR lpFontName = (LPWSTR)lParam;
SetFont(infoPtr, SetFont(infoPtr,
lpFontName); lpFontName);
@ -518,18 +517,18 @@ MapWndProc(HWND hwnd,
HeapFree(GetProcessHeap(), HeapFree(GetProcessHeap(),
0, 0,
infoPtr); infoPtr);
SetWindowLongPtr(hwnd, SetWindowLongPtrW(hwnd,
0, 0,
(DWORD_PTR)NULL); (DWORD_PTR)NULL);
break; break;
} }
default: default:
{ {
Ret = DefWindowProc(hwnd, Ret = DefWindowProcW(hwnd,
uMsg, uMsg,
wParam, wParam,
lParam); lParam);
break; break;
} }
} }
@ -541,24 +540,24 @@ MapWndProc(HWND hwnd,
BOOL BOOL
RegisterMapClasses(HINSTANCE hInstance) RegisterMapClasses(HINSTANCE hInstance)
{ {
WNDCLASS wc = {0}; WNDCLASSW wc = {0};
wc.style = CS_DBLCLKS; wc.style = CS_DBLCLKS;
wc.lpfnWndProc = MapWndProc; wc.lpfnWndProc = MapWndProc;
wc.cbWndExtra = sizeof(PMAP); wc.cbWndExtra = sizeof(PMAP);
wc.hInstance = hInstance; wc.hInstance = hInstance;
wc.hCursor = LoadCursor(NULL, wc.hCursor = LoadCursorW(NULL,
(LPTSTR)IDC_ARROW); (LPWSTR)IDC_ARROW);
wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
wc.lpszClassName = szMapWndClass; wc.lpszClassName = szMapWndClass;
if (RegisterClass(&wc)) if (RegisterClassW(&wc))
{ {
wc.lpfnWndProc = LrgCellWndProc; wc.lpfnWndProc = LrgCellWndProc;
wc.cbWndExtra = 0; wc.cbWndExtra = 0;
wc.lpszClassName = szLrgCellWndClass; wc.lpszClassName = szLrgCellWndClass;
return RegisterClass(&wc) != 0; return RegisterClassW(&wc) != 0;
} }
return FALSE; return FALSE;
@ -567,9 +566,9 @@ RegisterMapClasses(HINSTANCE hInstance)
VOID VOID
UnregisterMapClasses(HINSTANCE hInstance) UnregisterMapClasses(HINSTANCE hInstance)
{ {
UnregisterClass(szMapWndClass, UnregisterClassW(szMapWndClass,
hInstance); hInstance);
UnregisterClass(szLrgCellWndClass, UnregisterClassW(szLrgCellWndClass,
hInstance); hInstance);
} }

View file

@ -23,7 +23,7 @@ typedef struct _CELL
RECT CellInt; RECT CellInt;
BOOL bActive; BOOL bActive;
BOOL bLarge; BOOL bLarge;
TCHAR ch; WCHAR ch;
} CELL, *PCELL; } CELL, *PCELL;
typedef struct _MAP typedef struct _MAP
@ -36,13 +36,13 @@ typedef struct _MAP
CELL Cells[YCELLS][XCELLS]; CELL Cells[YCELLS][XCELLS];
PCELL pActiveCell; PCELL pActiveCell;
HFONT hFont; HFONT hFont;
LOGFONT CurrentFont; LOGFONTW CurrentFont;
INT iPage; INT iPage;
} MAP, *PMAP; } MAP, *PMAP;
typedef struct { typedef struct {
NMHDR hdr; NMHDR hdr;
TCHAR ch; WCHAR ch;
} MAPNOTIFY, *LPMAPNOTIFY; } MAPNOTIFY, *LPMAPNOTIFY;