Commit 182763f6 authored by Andrew Nguyen's avatar Andrew Nguyen Committed by Alexandre Julliard

regedit: Convert regedit main code to Unicode.

parent 3571ae27
...@@ -441,7 +441,7 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa ...@@ -441,7 +441,7 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
} }
/* fall through */ /* fall through */
default: def: default: def:
return DefWindowProc(hWnd, message, wParam, lParam); return DefWindowProcW(hWnd, message, wParam, lParam);
} }
return 0; return 0;
} }
...@@ -921,15 +921,17 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) ...@@ -921,15 +921,17 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
LRESULT CALLBACK FrameWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) LRESULT CALLBACK FrameWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{ {
static const WCHAR captionW[] = {'r','e','g','e','d','i','t',' ','c','h','i','l','d',' ','w','i','n','d','o','w',0};
switch (message) { switch (message) {
case WM_CREATE: case WM_CREATE:
CreateWindowEx(0, szChildClass, _T("regedit child window"), WS_CHILD | WS_VISIBLE, CreateWindowExW(0, szChildClass, captionW, WS_CHILD | WS_VISIBLE,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
hWnd, NULL, hInst, 0); hWnd, NULL, hInst, 0);
break; break;
case WM_COMMAND: case WM_COMMAND:
if (!_CmdWndProc(hWnd, message, wParam, lParam)) if (!_CmdWndProc(hWnd, message, wParam, lParam))
return DefWindowProc(hWnd, message, wParam, lParam); return DefWindowProcW(hWnd, message, wParam, lParam);
break; break;
case WM_ACTIVATE: case WM_ACTIVATE:
if (LOWORD(hWnd)) if (LOWORD(hWnd))
...@@ -960,7 +962,7 @@ LRESULT CALLBACK FrameWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa ...@@ -960,7 +962,7 @@ LRESULT CALLBACK FrameWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
PostQuitMessage(0); PostQuitMessage(0);
} }
default: default:
return DefWindowProc(hWnd, message, wParam, lParam); return DefWindowProcW(hWnd, message, wParam, lParam);
} }
return 0; return 0;
} }
...@@ -55,30 +55,30 @@ HWND hStatusBar; ...@@ -55,30 +55,30 @@ HWND hStatusBar;
HMENU hMenuFrame; HMENU hMenuFrame;
HMENU hPopupMenus = 0; HMENU hPopupMenus = 0;
UINT nClipboardFormat; UINT nClipboardFormat;
LPCTSTR strClipboardFormat = _T("TODO: SET CORRECT FORMAT"); const WCHAR strClipboardFormat[] = {'T','O','D','O',':',' ','S','E','T',' ','C','O','R','R','E','C','T',' ','F','O','R','M','A','T',0};
#define MAX_LOADSTRING 100 #define MAX_LOADSTRING 100
TCHAR szTitle[MAX_LOADSTRING]; WCHAR szTitle[MAX_LOADSTRING];
const TCHAR szFrameClass[] = {'R','E','G','E','D','I','T','_','F','R','A','M','E',0}; const WCHAR szFrameClass[] = {'R','E','G','E','D','I','T','_','F','R','A','M','E',0};
const TCHAR szChildClass[] = {'R','E','G','E','D','I','T',0}; const WCHAR szChildClass[] = {'R','E','G','E','D','I','T',0};
static BOOL RegisterWindowClasses(HINSTANCE hInstance, ATOM *hFrameWndClass, ATOM *hChildWndClass) static BOOL RegisterWindowClasses(HINSTANCE hInstance, ATOM *hFrameWndClass, ATOM *hChildWndClass)
{ {
WNDCLASSEX wndclass = {0}; WNDCLASSEXW wndclass = {0};
/* Frame class */ /* Frame class */
wndclass.cbSize = sizeof(WNDCLASSEX); wndclass.cbSize = sizeof(WNDCLASSEXW);
wndclass.style = CS_HREDRAW | CS_VREDRAW; wndclass.style = CS_HREDRAW | CS_VREDRAW;
wndclass.lpfnWndProc = FrameWndProc; wndclass.lpfnWndProc = FrameWndProc;
wndclass.hInstance = hInstance; wndclass.hInstance = hInstance;
wndclass.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_REGEDIT)); wndclass.hIcon = LoadIconW(hInstance, MAKEINTRESOURCEW(IDI_REGEDIT));
wndclass.hCursor = LoadCursor(0, IDC_ARROW); wndclass.hCursor = LoadCursorW(0, (LPCWSTR)IDC_ARROW);
wndclass.lpszClassName = szFrameClass; wndclass.lpszClassName = szFrameClass;
wndclass.hIconSm = LoadImage(hInstance, MAKEINTRESOURCE(IDI_REGEDIT), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), wndclass.hIconSm = LoadImageW(hInstance, MAKEINTRESOURCEW(IDI_REGEDIT), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON),
GetSystemMetrics(SM_CYSMICON), LR_SHARED); GetSystemMetrics(SM_CYSMICON), LR_SHARED);
if (!(*hFrameWndClass = RegisterClassEx(&wndclass))) if (!(*hFrameWndClass = RegisterClassExW(&wndclass)))
return FALSE; return FALSE;
/* Child class */ /* Child class */
...@@ -86,9 +86,9 @@ static BOOL RegisterWindowClasses(HINSTANCE hInstance, ATOM *hFrameWndClass, ATO ...@@ -86,9 +86,9 @@ static BOOL RegisterWindowClasses(HINSTANCE hInstance, ATOM *hFrameWndClass, ATO
wndclass.cbWndExtra = sizeof(HANDLE); wndclass.cbWndExtra = sizeof(HANDLE);
wndclass.lpszClassName = szChildClass; wndclass.lpszClassName = szChildClass;
if (!(*hChildWndClass = RegisterClassEx(&wndclass))) if (!(*hChildWndClass = RegisterClassExW(&wndclass)))
{ {
UnregisterClass(szFrameClass, hInstance); UnregisterClassW(szFrameClass, hInstance);
return FALSE; return FALSE;
} }
...@@ -112,9 +112,9 @@ static BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) ...@@ -112,9 +112,9 @@ static BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
/* register our hex editor control */ /* register our hex editor control */
HexEdit_Register(); HexEdit_Register();
nClipboardFormat = RegisterClipboardFormat(strClipboardFormat); nClipboardFormat = RegisterClipboardFormatW(strClipboardFormat);
hFrameWnd = CreateWindowEx(0, MAKEINTRESOURCE(hFrameWndClass), szTitle, hFrameWnd = CreateWindowExW(0, MAKEINTRESOURCEW(hFrameWndClass), szTitle,
WS_OVERLAPPEDWINDOW | WS_EX_CLIENTEDGE, WS_OVERLAPPEDWINDOW | WS_EX_CLIENTEDGE,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
NULL, hMenuFrame, hInstance, NULL/*lpParam*/); NULL, hMenuFrame, hInstance, NULL/*lpParam*/);
...@@ -148,7 +148,7 @@ static BOOL TranslateChildTabMessage(MSG *msg) ...@@ -148,7 +148,7 @@ static BOOL TranslateChildTabMessage(MSG *msg)
if (msg->message != WM_KEYDOWN) return FALSE; if (msg->message != WM_KEYDOWN) return FALSE;
if (msg->wParam != VK_TAB) return FALSE; if (msg->wParam != VK_TAB) return FALSE;
if (GetParent(msg->hwnd) != g_pChildWnd->hWnd) return FALSE; if (GetParent(msg->hwnd) != g_pChildWnd->hWnd) return FALSE;
PostMessage(g_pChildWnd->hWnd, WM_COMMAND, ID_SWITCH_PANELS, 0); PostMessageW(g_pChildWnd->hWnd, WM_COMMAND, ID_SWITCH_PANELS, 0);
return TRUE; return TRUE;
} }
...@@ -165,7 +165,7 @@ int APIENTRY WinMain(HINSTANCE hInstance, ...@@ -165,7 +165,7 @@ int APIENTRY WinMain(HINSTANCE hInstance,
} }
/* Initialize global strings */ /* Initialize global strings */
LoadString(hInstance, IDS_APP_TITLE, szTitle, COUNT_OF(szTitle)); LoadStringW(hInstance, IDS_APP_TITLE, szTitle, COUNT_OF(szTitle));
LoadStringW(hInstance, IDS_REGISTRY_DEFAULT_VALUE, g_pszDefaultValueName, COUNT_OF(g_pszDefaultValueName)); LoadStringW(hInstance, IDS_REGISTRY_DEFAULT_VALUE, g_pszDefaultValueName, COUNT_OF(g_pszDefaultValueName));
/* Store instance handle in our global variable */ /* Store instance handle in our global variable */
...@@ -175,14 +175,14 @@ int APIENTRY WinMain(HINSTANCE hInstance, ...@@ -175,14 +175,14 @@ int APIENTRY WinMain(HINSTANCE hInstance,
if (!InitInstance(hInstance, nCmdShow)) { if (!InitInstance(hInstance, nCmdShow)) {
return FALSE; return FALSE;
} }
hAccel = LoadAccelerators(hInstance, (LPCTSTR)IDC_REGEDIT); hAccel = LoadAcceleratorsW(hInstance, MAKEINTRESOURCEW(IDC_REGEDIT));
/* Main message loop */ /* Main message loop */
while (GetMessage(&msg, NULL, 0, 0)) { while (GetMessageW(&msg, NULL, 0, 0)) {
if (!TranslateAccelerator(hFrameWnd, hAccel, &msg) if (!TranslateAcceleratorW(hFrameWnd, hAccel, &msg)
&& !TranslateChildTabMessage(&msg)) { && !TranslateChildTabMessage(&msg)) {
TranslateMessage(&msg); TranslateMessage(&msg);
DispatchMessage(&msg); DispatchMessageW(&msg);
} }
} }
ExitInstance(); ExitInstance();
......
...@@ -87,9 +87,9 @@ extern HMENU hPopupMenus; ...@@ -87,9 +87,9 @@ extern HMENU hPopupMenus;
extern HFONT hFont; extern HFONT hFont;
extern enum OPTION_FLAGS Options; extern enum OPTION_FLAGS Options;
extern TCHAR szTitle[]; extern WCHAR szTitle[];
extern const TCHAR szFrameClass[]; extern const WCHAR szFrameClass[];
extern const TCHAR szChildClass[]; extern const WCHAR szChildClass[];
extern WCHAR g_pszDefaultValueName[]; extern WCHAR g_pszDefaultValueName[];
/* Registry class names and their indexes */ /* Registry class names and their indexes */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment