Alexander Nicolaysen Sørnes : regedit: Convert treeview init to Unicode.
Alexandre Julliard
julliard at winehq.org
Tue Aug 26 07:07:19 CDT 2008
Module: wine
Branch: master
Commit: be43131b49eede447acdf95065e33ff9674d74d2
URL: http://source.winehq.org/git/wine.git/?a=commit;h=be43131b49eede447acdf95065e33ff9674d74d2
Author: Alexander Nicolaysen Sørnes <alex at thehandofagony.com>
Date: Mon Aug 25 23:00:35 2008 +0200
regedit: Convert treeview init to Unicode.
---
programs/regedit/childwnd.c | 2 +-
programs/regedit/main.h | 4 ++--
programs/regedit/treeview.c | 25 +++++++++++++------------
3 files changed, 16 insertions(+), 15 deletions(-)
diff --git a/programs/regedit/childwnd.c b/programs/regedit/childwnd.c
index 42fefca..76f354d 100644
--- a/programs/regedit/childwnd.c
+++ b/programs/regedit/childwnd.c
@@ -304,7 +304,7 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
case WM_CREATE:
g_pChildWnd = HeapAlloc(GetProcessHeap(), 0, sizeof(ChildWnd));
if (!g_pChildWnd) return 0;
- LoadString(hInst, IDS_REGISTRY_ROOT_NAME, g_pChildWnd->szPath, MAX_PATH);
+ LoadStringW(hInst, IDS_REGISTRY_ROOT_NAME, g_pChildWnd->szPath, MAX_PATH);
g_pChildWnd->nSplitPos = 250;
g_pChildWnd->hWnd = hWnd;
g_pChildWnd->hTreeWnd = CreateTreeView(hWnd, g_pChildWnd->szPath, TREE_WINDOW);
diff --git a/programs/regedit/main.h b/programs/regedit/main.h
index 0398f57..55f2201 100644
--- a/programs/regedit/main.h
+++ b/programs/regedit/main.h
@@ -72,7 +72,7 @@ typedef struct {
int nFocusPanel; /* 0: left 1: right */
int nSplitPos;
WINDOWPLACEMENT pos;
- TCHAR szPath[MAX_PATH];
+ WCHAR szPath[MAX_PATH];
} ChildWnd;
extern ChildWnd* g_pChildWnd;
@@ -128,7 +128,7 @@ extern BOOL ListWndNotifyProc(HWND hWnd, WPARAM wParam, LPARAM lParam, BOOL *Res
extern BOOL IsDefaultValue(HWND hwndLV, int i);
/* treeview.c */
-extern HWND CreateTreeView(HWND hwndParent, LPTSTR pHostName, UINT id);
+extern HWND CreateTreeView(HWND hwndParent, LPWSTR pHostName, UINT id);
extern BOOL RefreshTreeView(HWND hWndTV);
extern BOOL OnTreeExpanding(HWND hWnd, NMTREEVIEW* pnmtv);
extern LPTSTR GetItemPath(HWND hwndTV, HTREEITEM hItem, HKEY* phRootKey);
diff --git a/programs/regedit/treeview.c b/programs/regedit/treeview.c
index e3ea8b8..92c2af2 100644
--- a/programs/regedit/treeview.c
+++ b/programs/regedit/treeview.c
@@ -567,9 +567,9 @@ HWND StartKeyRename(HWND hwndTV)
return TreeView_EditLabel(hwndTV, hItem);
}
-static BOOL InitTreeViewItems(HWND hwndTV, LPTSTR pHostName)
+static BOOL InitTreeViewItems(HWND hwndTV, LPWSTR pHostName)
{
- TVINSERTSTRUCT tvins;
+ TVINSERTSTRUCTW tvins;
HTREEITEM hRoot;
static WCHAR hkcr[] = {'H','K','E','Y','_','C','L','A','S','S','E','S','_','R','O','O','T',0},
hkcu[] = {'H','K','E','Y','_','C','U','R','R','E','N','T','_','U','S','E','R',0},
@@ -581,7 +581,7 @@ static BOOL InitTreeViewItems(HWND hwndTV, LPTSTR pHostName)
tvins.u.item.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_CHILDREN | TVIF_PARAM;
/* Set the text of the item. */
tvins.u.item.pszText = pHostName;
- tvins.u.item.cchTextMax = lstrlen(pHostName);
+ tvins.u.item.cchTextMax = lstrlenW(pHostName);
/* Assume the item is not a parent item, so give it an image. */
tvins.u.item.iImage = Image_Root;
tvins.u.item.iSelectedImage = Image_Root;
@@ -591,7 +591,7 @@ static BOOL InitTreeViewItems(HWND hwndTV, LPTSTR pHostName)
tvins.hInsertAfter = (HTREEITEM)TVI_FIRST;
tvins.hParent = TVI_ROOT;
/* Add the item to the tree view control. */
- if (!(hRoot = TreeView_InsertItem(hwndTV, &tvins))) return FALSE;
+ if (!(hRoot = TreeView_InsertItemW(hwndTV, &tvins))) return FALSE;
if (!AddEntryToTree(hwndTV, hRoot, hkcr, HKEY_CLASSES_ROOT, 1)) return FALSE;
if (!AddEntryToTree(hwndTV, hRoot, hkcu, HKEY_CURRENT_USER, 1)) return FALSE;
@@ -601,8 +601,8 @@ static BOOL InitTreeViewItems(HWND hwndTV, LPTSTR pHostName)
if (!AddEntryToTree(hwndTV, hRoot, hkdd, HKEY_DYN_DATA, 1)) return FALSE;
/* expand and select host name */
- SendMessage(hwndTV, TVM_EXPAND, TVE_EXPAND, (LPARAM)hRoot );
- SendMessage(hwndTV, TVM_SELECTITEM, TVGN_CARET, (LPARAM)hRoot);
+ SendMessageW(hwndTV, TVM_EXPAND, TVE_EXPAND, (LPARAM)hRoot );
+ SendMessageW(hwndTV, TVM_SELECTITEM, TVGN_CARET, (LPARAM)hRoot);
return TRUE;
}
@@ -624,13 +624,13 @@ static BOOL InitTreeViewImageLists(HWND hwndTV)
return FALSE;
/* Add the open file, closed file, and document bitmaps. */
- hico = LoadIcon(hInst, MAKEINTRESOURCE(IDI_OPEN_FILE));
+ hico = LoadIconW(hInst, MAKEINTRESOURCEW(IDI_OPEN_FILE));
Image_Open = ImageList_AddIcon(himl, hico);
- hico = LoadIcon(hInst, MAKEINTRESOURCE(IDI_CLOSED_FILE));
+ hico = LoadIconW(hInst, MAKEINTRESOURCEW(IDI_CLOSED_FILE));
Image_Closed = ImageList_AddIcon(himl, hico);
- hico = LoadIcon(hInst, MAKEINTRESOURCE(IDI_ROOT));
+ hico = LoadIconW(hInst, MAKEINTRESOURCEW(IDI_ROOT));
Image_Root = ImageList_AddIcon(himl, hico);
/* Fail if not all of the images were added. */
@@ -640,7 +640,7 @@ static BOOL InitTreeViewImageLists(HWND hwndTV)
}
/* Associate the image list with the tree view control. */
- SendMessage(hwndTV, TVM_SETIMAGELIST, TVSIL_NORMAL, (LPARAM)himl);
+ SendMessageW(hwndTV, TVM_SETIMAGELIST, TVSIL_NORMAL, (LPARAM)himl);
return TRUE;
}
@@ -716,14 +716,15 @@ BOOL OnTreeExpanding(HWND hwndTV, NMTREEVIEW* pnmtv)
* Returns the handle to the new control if successful, or NULL otherwise.
* hwndParent - handle to the control's parent window.
*/
-HWND CreateTreeView(HWND hwndParent, LPTSTR pHostName, UINT id)
+HWND CreateTreeView(HWND hwndParent, LPWSTR pHostName, UINT id)
{
RECT rcClient;
HWND hwndTV;
+ WCHAR TreeView[] = {'T','r','e','e',' ','V','i','e','w',0};
/* Get the dimensions of the parent window's client area, and create the tree view control. */
GetClientRect(hwndParent, &rcClient);
- hwndTV = CreateWindowEx(WS_EX_CLIENTEDGE, WC_TREEVIEW, _T("Tree View"),
+ hwndTV = CreateWindowExW(WS_EX_CLIENTEDGE, WC_TREEVIEWW, TreeView,
WS_VISIBLE | WS_CHILD | WS_TABSTOP | TVS_HASLINES | TVS_HASBUTTONS | TVS_LINESATROOT,
0, 0, rcClient.right, rcClient.bottom,
hwndParent, (HMENU)ULongToHandle(id), hInst, NULL);
More information about the wine-cvs
mailing list