Alexander Nicolaysen Sørnes : regedit: Convert menu & statusbar handling to unicode.
Alexandre Julliard
julliard at winehq.org
Wed Aug 27 08:24:13 CDT 2008
Module: wine
Branch: master
Commit: 46ea43e677b091f677ebdea41846b1ee2723943c
URL: http://source.winehq.org/git/wine.git/?a=commit;h=46ea43e677b091f677ebdea41846b1ee2723943c
Author: Alexander Nicolaysen Sørnes <alex at thehandofagony.com>
Date: Tue Aug 26 19:55:35 2008 +0200
regedit: Convert menu & statusbar handling to unicode.
---
programs/regedit/framewnd.c | 32 ++++++++++++++++++--------------
programs/regedit/main.c | 9 +++++----
2 files changed, 23 insertions(+), 18 deletions(-)
diff --git a/programs/regedit/framewnd.c b/programs/regedit/framewnd.c
index 1a91826..eb248c9 100644
--- a/programs/regedit/framewnd.c
+++ b/programs/regedit/framewnd.c
@@ -31,6 +31,7 @@
#include "main.h"
#include "regproc.h"
+#include "wine/unicode.h"
/********************************************************************************
* Global and Local Variables:
@@ -82,12 +83,13 @@ static void resize_frame_client(HWND hWnd)
static void OnEnterMenuLoop(HWND hWnd)
{
int nParts;
+ WCHAR empty = 0;
/* Update the status bar pane sizes */
nParts = -1;
- SendMessage(hStatusBar, SB_SETPARTS, 1, (long)&nParts);
+ SendMessageW(hStatusBar, SB_SETPARTS, 1, (long)&nParts);
bInMenuLoop = TRUE;
- SendMessage(hStatusBar, SB_SETTEXT, (WPARAM)0, (LPARAM)_T(""));
+ SendMessageW(hStatusBar, SB_SETTEXTW, (WPARAM)0, (LPARAM)&empty);
}
static void OnExitMenuLoop(HWND hWnd)
@@ -102,8 +104,8 @@ static void UpdateMenuItems(HMENU hMenu) {
HWND hwndTV = g_pChildWnd->hTreeWnd;
BOOL bAllowEdit = FALSE;
HKEY hRootKey = NULL;
- LPCTSTR keyName;
- keyName = GetItemPath(hwndTV, TreeView_GetSelection(hwndTV), &hRootKey);
+ LPWSTR keyName;
+ keyName = GetItemPathW(hwndTV, TreeView_GetSelection(hwndTV), &hRootKey);
if (GetFocus() != hwndTV || (keyName && *keyName)) { /* can't modify root keys, but allow for their values */
bAllowEdit = TRUE;
}
@@ -115,6 +117,8 @@ static void UpdateMenuItems(HMENU hMenu) {
EnableMenuItem(hMenu, ID_FAVORITES_ADDTOFAVORITES, (hRootKey ? MF_ENABLED : MF_GRAYED) | MF_BYCOMMAND);
EnableMenuItem(hMenu, ID_FAVORITES_REMOVEFAVORITE,
(GetMenuItemCount(hMenu)>2 ? MF_ENABLED : MF_GRAYED) | MF_BYCOMMAND);
+
+ HeapFree(GetProcessHeap(), 0, keyName);
}
static void OnInitMenuPopup(HWND hWnd, HMENU hMenu, short wItem)
@@ -154,23 +158,23 @@ static void OnInitMenuPopup(HWND hWnd, HMENU hMenu, short wItem)
static void OnMenuSelect(HWND hWnd, UINT nItemID, UINT nFlags, HMENU hSysMenu)
{
- TCHAR str[100];
+ WCHAR str[100];
- _tcscpy(str, _T(""));
+ str[0] = 0;
if (nFlags & MF_POPUP) {
if (hSysMenu != GetMenu(hWnd)) {
if (nItemID == 2) nItemID = 5;
}
}
- if (LoadString(hInst, nItemID, str, 100)) {
+ if (LoadStringW(hInst, nItemID, str, 100)) {
/* load appropriate string*/
- LPTSTR lpsz = str;
+ LPWSTR lpsz = str;
/* first newline terminates actual string*/
- lpsz = _tcschr(lpsz, '\n');
+ lpsz = strchrW(lpsz, '\n');
if (lpsz != NULL)
*lpsz = '\0';
}
- SendMessage(hStatusBar, SB_SETTEXT, 0, (LPARAM)str);
+ SendMessageW(hStatusBar, SB_SETTEXTW, 0, (LPARAM)str);
}
void SetupStatusBar(HWND hWnd, BOOL bResize)
@@ -181,15 +185,15 @@ void SetupStatusBar(HWND hWnd, BOOL bResize)
nParts = rc.right;
/* nParts = -1;*/
if (bResize)
- SendMessage(hStatusBar, WM_SIZE, 0, 0);
- SendMessage(hStatusBar, SB_SETPARTS, 1, (LPARAM)&nParts);
+ SendMessageW(hStatusBar, WM_SIZE, 0, 0);
+ SendMessageW(hStatusBar, SB_SETPARTS, 1, (LPARAM)&nParts);
UpdateStatusBar();
}
void UpdateStatusBar(void)
{
- LPTSTR fullPath = GetItemFullPath(g_pChildWnd->hTreeWnd, NULL, TRUE);
- SendMessage(hStatusBar, SB_SETTEXT, 0, (LPARAM)fullPath);
+ LPWSTR fullPath = GetItemFullPathW(g_pChildWnd->hTreeWnd, NULL, TRUE);
+ SendMessageW(hStatusBar, SB_SETTEXTW, 0, (LPARAM)fullPath);
HeapFree(GetProcessHeap(), 0, fullPath);
}
diff --git a/programs/regedit/main.c b/programs/regedit/main.c
index 5661b26..3033d7d 100644
--- a/programs/regedit/main.c
+++ b/programs/regedit/main.c
@@ -80,6 +80,7 @@ const TCHAR szChildClass[] = {'R','E','G','E','D','I','T',0};
static BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
+ WCHAR empty = 0;
WNDCLASSEX wcFrame = {
sizeof(WNDCLASSEX),
CS_HREDRAW | CS_VREDRAW/*style*/,
@@ -116,8 +117,8 @@ static BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
ATOM hChildWndClass = RegisterClassEx(&wcChild); /* register child windows class */
hChildWndClass = hChildWndClass; /* warning eater */
- hMenuFrame = LoadMenu(hInstance, MAKEINTRESOURCE(IDR_REGEDIT_MENU));
- hPopupMenus = LoadMenu(hInstance, MAKEINTRESOURCE(IDR_POPUP_MENUS));
+ hMenuFrame = LoadMenuW(hInstance, MAKEINTRESOURCEW(IDR_REGEDIT_MENU));
+ hPopupMenus = LoadMenuW(hInstance, MAKEINTRESOURCEW(IDR_POPUP_MENUS));
/* Initialize the Windows Common Controls DLL */
InitCommonControls();
@@ -140,8 +141,8 @@ static BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
}
/* Create the status bar */
- hStatusBar = CreateStatusWindow(WS_VISIBLE|WS_CHILD|WS_CLIPSIBLINGS|SBT_NOBORDERS,
- _T(""), hFrameWnd, STATUS_WINDOW);
+ hStatusBar = CreateStatusWindowW(WS_VISIBLE|WS_CHILD|WS_CLIPSIBLINGS|SBT_NOBORDERS,
+ &empty, hFrameWnd, STATUS_WINDOW);
if (hStatusBar) {
/* Create the status bar panes */
SetupStatusBar(hFrameWnd, FALSE);
More information about the wine-cvs
mailing list