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
}
/* fall through */
default: def:
return DefWindowProc(hWnd, message, wParam, lParam);
return DefWindowProcW(hWnd, message, wParam, lParam);
}
return 0;
}
......@@ -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)
{
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) {
case WM_CREATE:
CreateWindowEx(0, szChildClass, _T("regedit child window"), WS_CHILD | WS_VISIBLE,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
hWnd, NULL, hInst, 0);
CreateWindowExW(0, szChildClass, captionW, WS_CHILD | WS_VISIBLE,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
hWnd, NULL, hInst, 0);
break;
case WM_COMMAND:
if (!_CmdWndProc(hWnd, message, wParam, lParam))
return DefWindowProc(hWnd, message, wParam, lParam);
return DefWindowProcW(hWnd, message, wParam, lParam);
break;
case WM_ACTIVATE:
if (LOWORD(hWnd))
......@@ -960,7 +962,7 @@ LRESULT CALLBACK FrameWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
PostQuitMessage(0);
}
default:
return DefWindowProc(hWnd, message, wParam, lParam);
return DefWindowProcW(hWnd, message, wParam, lParam);
}
return 0;
}
......@@ -55,30 +55,30 @@ HWND hStatusBar;
HMENU hMenuFrame;
HMENU hPopupMenus = 0;
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
TCHAR szTitle[MAX_LOADSTRING];
const TCHAR 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};
WCHAR szTitle[MAX_LOADSTRING];
const WCHAR szFrameClass[] = {'R','E','G','E','D','I','T','_','F','R','A','M','E',0};
const WCHAR szChildClass[] = {'R','E','G','E','D','I','T',0};
static BOOL RegisterWindowClasses(HINSTANCE hInstance, ATOM *hFrameWndClass, ATOM *hChildWndClass)
{
WNDCLASSEX wndclass = {0};
WNDCLASSEXW wndclass = {0};
/* Frame class */
wndclass.cbSize = sizeof(WNDCLASSEX);
wndclass.cbSize = sizeof(WNDCLASSEXW);
wndclass.style = CS_HREDRAW | CS_VREDRAW;
wndclass.lpfnWndProc = FrameWndProc;
wndclass.hInstance = hInstance;
wndclass.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_REGEDIT));
wndclass.hCursor = LoadCursor(0, IDC_ARROW);
wndclass.hIcon = LoadIconW(hInstance, MAKEINTRESOURCEW(IDI_REGEDIT));
wndclass.hCursor = LoadCursorW(0, (LPCWSTR)IDC_ARROW);
wndclass.lpszClassName = szFrameClass;
wndclass.hIconSm = LoadImage(hInstance, MAKEINTRESOURCE(IDI_REGEDIT), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON),
GetSystemMetrics(SM_CYSMICON), LR_SHARED);
wndclass.hIconSm = LoadImageW(hInstance, MAKEINTRESOURCEW(IDI_REGEDIT), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON),
GetSystemMetrics(SM_CYSMICON), LR_SHARED);
if (!(*hFrameWndClass = RegisterClassEx(&wndclass)))
if (!(*hFrameWndClass = RegisterClassExW(&wndclass)))
return FALSE;
/* Child class */
......@@ -86,9 +86,9 @@ static BOOL RegisterWindowClasses(HINSTANCE hInstance, ATOM *hFrameWndClass, ATO
wndclass.cbWndExtra = sizeof(HANDLE);
wndclass.lpszClassName = szChildClass;
if (!(*hChildWndClass = RegisterClassEx(&wndclass)))
if (!(*hChildWndClass = RegisterClassExW(&wndclass)))
{
UnregisterClass(szFrameClass, hInstance);
UnregisterClassW(szFrameClass, hInstance);
return FALSE;
}
......@@ -112,12 +112,12 @@ static BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
/* register our hex editor control */
HexEdit_Register();
nClipboardFormat = RegisterClipboardFormat(strClipboardFormat);
nClipboardFormat = RegisterClipboardFormatW(strClipboardFormat);
hFrameWnd = CreateWindowEx(0, MAKEINTRESOURCE(hFrameWndClass), szTitle,
WS_OVERLAPPEDWINDOW | WS_EX_CLIENTEDGE,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
NULL, hMenuFrame, hInstance, NULL/*lpParam*/);
hFrameWnd = CreateWindowExW(0, MAKEINTRESOURCEW(hFrameWndClass), szTitle,
WS_OVERLAPPEDWINDOW | WS_EX_CLIENTEDGE,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
NULL, hMenuFrame, hInstance, NULL/*lpParam*/);
if (!hFrameWnd) {
return FALSE;
......@@ -148,7 +148,7 @@ static BOOL TranslateChildTabMessage(MSG *msg)
if (msg->message != WM_KEYDOWN) return FALSE;
if (msg->wParam != VK_TAB) 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;
}
......@@ -165,7 +165,7 @@ int APIENTRY WinMain(HINSTANCE hInstance,
}
/* 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));
/* Store instance handle in our global variable */
......@@ -175,14 +175,14 @@ int APIENTRY WinMain(HINSTANCE hInstance,
if (!InitInstance(hInstance, nCmdShow)) {
return FALSE;
}
hAccel = LoadAccelerators(hInstance, (LPCTSTR)IDC_REGEDIT);
hAccel = LoadAcceleratorsW(hInstance, MAKEINTRESOURCEW(IDC_REGEDIT));
/* Main message loop */
while (GetMessage(&msg, NULL, 0, 0)) {
if (!TranslateAccelerator(hFrameWnd, hAccel, &msg)
while (GetMessageW(&msg, NULL, 0, 0)) {
if (!TranslateAcceleratorW(hFrameWnd, hAccel, &msg)
&& !TranslateChildTabMessage(&msg)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
DispatchMessageW(&msg);
}
}
ExitInstance();
......
......@@ -87,9 +87,9 @@ extern HMENU hPopupMenus;
extern HFONT hFont;
extern enum OPTION_FLAGS Options;
extern TCHAR szTitle[];
extern const TCHAR szFrameClass[];
extern const TCHAR szChildClass[];
extern WCHAR szTitle[];
extern const WCHAR szFrameClass[];
extern const WCHAR szChildClass[];
extern WCHAR g_pszDefaultValueName[];
/* 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