From d67986b9dd3d23e8515df56eedb2888a91677704 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Nicolaysen=20S=C3=B8rnes?= Date: Tue, 2 Sep 2008 19:26:44 +0200 Subject: [PATCH] regedit: Some minor unicode conversions. --- programs/regedit/childwnd.c | 2 +- programs/regedit/edit.c | 18 ++++++++++-------- programs/regedit/framewnd.c | 10 +++++----- programs/regedit/listview.c | 4 ++-- 4 files changed, 18 insertions(+), 16 deletions(-) diff --git a/programs/regedit/childwnd.c b/programs/regedit/childwnd.c index 18323c0effa..6f9d4876200 100644 --- a/programs/regedit/childwnd.c +++ b/programs/regedit/childwnd.c @@ -379,7 +379,7 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa if (((int)wParam == LIST_WINDOW) && (g_pChildWnd != NULL)) { if (((LPNMHDR)lParam)->code == NM_SETFOCUS) { g_pChildWnd->nFocusPanel = 1; - } else if (!SendMessage(g_pChildWnd->hListWnd, WM_NOTIFY_REFLECT, wParam, lParam)) { + } else if (!SendMessageW(g_pChildWnd->hListWnd, WM_NOTIFY_REFLECT, wParam, lParam)) { goto def; } } diff --git a/programs/regedit/edit.c b/programs/regedit/edit.c index 992caeee13f..5856b641b2f 100644 --- a/programs/regedit/edit.c +++ b/programs/regedit/edit.c @@ -87,17 +87,19 @@ void error(HWND hwnd, INT resId, ...) static void error_code_messagebox(HWND hwnd, DWORD error_code) { - LPTSTR lpMsgBuf; + LPWSTR lpMsgBuf; DWORD status; - TCHAR title[256]; - static TCHAR fallback[] = TEXT("Error displaying error message.\n"); - if (!LoadString(hInst, IDS_ERROR, title, COUNT_OF(title))) - lstrcpy(title, TEXT("Error")); - status = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, - NULL, error_code, 0, (LPTSTR)&lpMsgBuf, 0, NULL); + WCHAR title[256]; + static WCHAR fallback[] = {'E','r','r','o','r',' ','d','i','s','p','l','a','y','i','n','g',' ','e','r','r','o','r',' ','m','e','s','s','a','g','e','.','\n',0}; + static const WCHAR title_error[] = {'E','r','r','o','r',0}; + + if (!LoadStringW(hInst, IDS_ERROR, title, COUNT_OF(title))) + lstrcpyW(title, title_error); + status = FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, + NULL, error_code, 0, (LPWSTR)&lpMsgBuf, 0, NULL); if (!status) lpMsgBuf = fallback; - MessageBox(hwnd, lpMsgBuf, title, MB_OK | MB_ICONERROR); + MessageBoxW(hwnd, lpMsgBuf, title, MB_OK | MB_ICONERROR); if (lpMsgBuf != fallback) LocalFree(lpMsgBuf); } diff --git a/programs/regedit/framewnd.c b/programs/regedit/framewnd.c index 0fef96e2b75..a8e4c5c8d6e 100644 --- a/programs/regedit/framewnd.c +++ b/programs/regedit/framewnd.c @@ -56,7 +56,7 @@ static void resize_frame_rect(HWND hWnd, PRECT prect) RECT rt; /* if (IsWindowVisible(hToolBar)) { - SendMessage(hToolBar, WM_SIZE, 0, 0); + SendMessageW(hToolBar, WM_SIZE, 0, 0); GetClientRect(hToolBar, &rt); prect->top = rt.bottom+3; prect->bottom -= rt.bottom+3; @@ -607,8 +607,8 @@ static INT_PTR CALLBACK removefavorite_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM w } break; case IDOK: { - int pos = SendMessage(hwndList, LB_GETCURSEL, 0, 0); - int len = SendMessage(hwndList, LB_GETTEXTLEN, pos, 0); + int pos = SendMessageW(hwndList, LB_GETCURSEL, 0, 0); + int len = SendMessageW(hwndList, LB_GETTEXTLEN, pos, 0); if (len>0) { LPWSTR lpName = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR)*(len+1)); SendMessageW(hwndList, LB_GETTEXT, pos, (LPARAM)lpName); @@ -739,7 +739,7 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) hItem = FindNext(g_pChildWnd->hTreeWnd, hItem, searchString, searchMask, &row); SetCursor(hcursorOld); if (hItem) { - SendMessage( g_pChildWnd->hTreeWnd, TVM_SELECTITEM, TVGN_CARET, (LPARAM) hItem ); + SendMessageW( g_pChildWnd->hTreeWnd, TVM_SELECTITEM, TVGN_CARET, (LPARAM) hItem ); InvalidateRect(g_pChildWnd->hTreeWnd, NULL, TRUE); UpdateWindow(g_pChildWnd->hTreeWnd); if (row != -1) { @@ -886,7 +886,7 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) if(ClientToScreen(g_pChildWnd->hWnd, &pts)) { SetCursorPos(pts.x, pts.y); SetCursor(LoadCursor(0, IDC_SIZEWE)); - SendMessage(g_pChildWnd->hWnd, WM_LBUTTONDOWN, 0, MAKELPARAM(pt.x, pt.y)); + SendMessageW(g_pChildWnd->hWnd, WM_LBUTTONDOWN, 0, MAKELPARAM(pt.x, pt.y)); } return TRUE; } diff --git a/programs/regedit/listview.c b/programs/regedit/listview.c index 04f63ac4dfa..65efecb5405 100644 --- a/programs/regedit/listview.c +++ b/programs/regedit/listview.c @@ -411,7 +411,7 @@ static LRESULT CALLBACK ListWndProc(HWND hWnd, UINT message, WPARAM wParam, LPAR case NM_RETURN: { int cnt = ListView_GetNextItem(hWnd, -1, LVNI_FOCUSED | LVNI_SELECTED); if (cnt != -1) - SendMessage(hFrameWnd, WM_COMMAND, ID_EDIT_MODIFY, 0); + SendMessageW(hFrameWnd, WM_COMMAND, ID_EDIT_MODIFY, 0); } break; case NM_DBLCLK: { @@ -439,7 +439,7 @@ static LRESULT CALLBACK ListWndProc(HWND hWnd, UINT message, WPARAM wParam, LPAR ListView_SetItemState(hWnd, -1, 0, LVIS_FOCUSED|LVIS_SELECTED); ListView_SetItemState(hWnd, info.iItem, LVIS_FOCUSED|LVIS_SELECTED, LVIS_FOCUSED|LVIS_SELECTED); - SendMessage(hFrameWnd, WM_COMMAND, ID_EDIT_MODIFY, 0); + SendMessageW(hFrameWnd, WM_COMMAND, ID_EDIT_MODIFY, 0); } } break;