4 * Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23 /* Global variables and constants */
24 /* Image_Open, Image_Closed, and Image_Root - integer variables for indexes of the images. */
25 /* CX_ICON and CY_ICON - width and height of an icon. */
26 /* NUM_ICON - number of icons to add to the image list. */
27 static int Image_Open
= 0;
28 static int Image_Closed
= 0;
29 static int Image_Root
= 0;
31 static LPTSTR pathBuffer
;
35 static BOOL
get_item_path(HWND hwndTV
, HTREEITEM hItem
, HKEY
* phKey
, LPTSTR
* pKeyPath
, int* pPathLen
, int* pMaxLen
)
41 item
.mask
= TVIF_PARAM
;
43 if (!TreeView_GetItem(hwndTV
, &item
)) return FALSE
;
46 /* found root key with valid key value */
47 *phKey
= (HKEY
)item
.lParam
;
51 if(!get_item_path(hwndTV
, TreeView_GetParent(hwndTV
, hItem
), phKey
, pKeyPath
, pPathLen
, pMaxLen
)) return FALSE
;
53 (*pKeyPath
)[*pPathLen
] = _T('\\');
58 item
.mask
= TVIF_TEXT
;
60 item
.pszText
= *pKeyPath
+ *pPathLen
;
61 maxLen
= *pMaxLen
- *pPathLen
;
62 item
.cchTextMax
= (int) maxLen
;
63 if (!TreeView_GetItem(hwndTV
, &item
)) return FALSE
;
64 len
= _tcslen(item
.pszText
);
65 if (len
< maxLen
- 1) {
66 *pPathLen
+= (int) len
;
69 newStr
= HeapReAlloc(GetProcessHeap(), 0, *pKeyPath
, *pMaxLen
* 2);
70 if (!newStr
) return FALSE
;
78 LPCTSTR
GetItemPath(HWND hwndTV
, HTREEITEM hItem
, HKEY
* phRootKey
)
80 int pathLen
= 0, maxLen
;
83 if (!pathBuffer
) pathBuffer
= HeapAlloc(GetProcessHeap(), 0, 1024);
84 if (!pathBuffer
) return NULL
;
86 maxLen
= (int) HeapSize(GetProcessHeap(), 0, pathBuffer
);
87 if (maxLen
== -1) return NULL
;
88 if (!hItem
) hItem
= TreeView_GetSelection(hwndTV
);
89 if (!hItem
) return NULL
;
90 if (!get_item_path(hwndTV
, hItem
, phRootKey
, &pathBuffer
, &pathLen
, &maxLen
)) {
96 BOOL
DeleteNode(HWND hwndTV
, HTREEITEM hItem
)
98 if (!hItem
) hItem
= TreeView_GetSelection(hwndTV
);
99 if (!hItem
) return FALSE
;
100 return TreeView_DeleteItem(hwndTV
, hItem
);
103 /* Add an entry to the tree. Only give hKey for root nodes (HKEY_ constants) */
104 static HTREEITEM
AddEntryToTree(HWND hwndTV
, HTREEITEM hParent
, LPTSTR label
, HKEY hKey
, DWORD dwChildren
)
107 TVINSERTSTRUCT tvins
;
110 if (RegQueryInfoKey(hKey
, 0, 0, 0, &dwChildren
, 0, 0, 0, 0, 0, 0, 0) != ERROR_SUCCESS
) {
115 tvi
.mask
= TVIF_TEXT
| TVIF_IMAGE
| TVIF_SELECTEDIMAGE
| TVIF_CHILDREN
| TVIF_PARAM
;
117 tvi
.cchTextMax
= lstrlen(tvi
.pszText
);
118 tvi
.iImage
= Image_Closed
;
119 tvi
.iSelectedImage
= Image_Open
;
120 tvi
.cChildren
= dwChildren
;
121 tvi
.lParam
= (LPARAM
)hKey
;
123 tvins
.hInsertAfter
= (HTREEITEM
)(hKey
? TVI_LAST
: TVI_FIRST
);
124 tvins
.hParent
= hParent
;
125 return TreeView_InsertItem(hwndTV
, &tvins
);
128 BOOL
RefreshTreeItem(HWND hwndTV
, HTREEITEM hItem
)
130 HKEY hRoot
, hKey
, hSubKey
;
133 DWORD dwCount
, dwIndex
, dwMaxSubKeyLen
;
136 LPTSTR pszNodes
= NULL
;
137 BOOL bSuccess
= FALSE
;
141 KeyPath
= GetItemPath(hwndTV
, hItem
, &hRoot
);
144 if (RegOpenKeyEx(hRoot
, KeyPath
, 0, KEY_READ
, &hKey
) != ERROR_SUCCESS
) {
151 if (RegQueryInfoKey(hKey
, 0, 0, 0, &dwCount
, &dwMaxSubKeyLen
, 0, 0, 0, 0, 0, 0) != ERROR_SUCCESS
) {
155 /* Set the number of children again */
156 tvItem
.mask
= TVIF_CHILDREN
;
157 tvItem
.hItem
= hItem
;
158 tvItem
.cChildren
= dwCount
;
159 if (!TreeView_SetItem(hwndTV
, &tvItem
)) {
163 /* We don't have to bother with the rest if it's not expanded. */
164 if (TreeView_GetItemState(hwndTV
, hItem
, TVIS_EXPANDED
) == 0) {
170 dwMaxSubKeyLen
++; /* account for the \0 terminator */
171 if (!(Name
= HeapAlloc(GetProcessHeap(), 0, dwMaxSubKeyLen
* sizeof(TCHAR
)))) {
174 tvItem
.cchTextMax
= dwMaxSubKeyLen
;
175 /*if (!(tvItem.pszText = HeapAlloc(GetProcessHeap(), 0, dwMaxSubKeyLen * sizeof(TCHAR)))) {
179 /* Get all of the tree node siblings in one contiguous block of memory */
181 DWORD dwPhysicalSize
= 0;
182 DWORD dwActualSize
= 0;
183 DWORD dwNewPhysicalSize
;
185 DWORD dwStep
= 10000;
187 for (childItem
= TreeView_GetChild(hwndTV
, hItem
); childItem
;
188 childItem
= TreeView_GetNextSibling(hwndTV
, childItem
)) {
190 if (dwActualSize
+ dwMaxSubKeyLen
+ 1 > dwPhysicalSize
)
192 dwNewPhysicalSize
= dwActualSize
+ dwMaxSubKeyLen
+ 1 + dwStep
;
195 pszNewNodes
= (LPTSTR
) HeapReAlloc(GetProcessHeap(), 0, pszNodes
, dwNewPhysicalSize
* sizeof(TCHAR
));
197 pszNewNodes
= (LPTSTR
) HeapAlloc(GetProcessHeap(), 0, dwNewPhysicalSize
* sizeof(TCHAR
));
201 dwPhysicalSize
= dwNewPhysicalSize
;
202 pszNodes
= pszNewNodes
;
205 tvItem
.mask
= TVIF_TEXT
;
206 tvItem
.hItem
= childItem
;
207 tvItem
.pszText
= &pszNodes
[dwActualSize
];
208 tvItem
.cchTextMax
= dwPhysicalSize
- dwActualSize
;
209 if (!TreeView_GetItem(hwndTV
, &tvItem
))
212 dwActualSize
+= (DWORD
) _tcslen(&pszNodes
[dwActualSize
]) + 1;
216 pszNodes
[dwActualSize
] = '\0';
219 /* Now go through all the children in the tree, and check if any have to be removed. */
220 childItem
= TreeView_GetChild(hwndTV
, hItem
);
222 HTREEITEM nextItem
= TreeView_GetNextSibling(hwndTV
, childItem
);
223 if (RefreshTreeItem(hwndTV
, childItem
) == FALSE
) {
224 (void)TreeView_DeleteItem(hwndTV
, childItem
);
226 childItem
= nextItem
;
229 /* Now go through all the children in the registry, and check if any have to be added. */
231 for (dwIndex
= 0; dwIndex
< dwCount
; dwIndex
++) {
232 DWORD cName
= dwMaxSubKeyLen
, dwSubCount
;
236 if (RegEnumKeyEx(hKey
, dwIndex
, Name
, &cName
, 0, 0, 0, NULL
) != ERROR_SUCCESS
) {
240 /* Check if the node is already in there. */
242 for (s
= pszNodes
; *s
; s
+= _tcslen(s
) + 1) {
243 if (!_tcscmp(s
, Name
)) {
250 if (found
== FALSE
) {
251 /* Find the number of children of the node. */
253 if (RegOpenKeyEx(hKey
, Name
, 0, KEY_QUERY_VALUE
, &hSubKey
) == ERROR_SUCCESS
) {
254 if (RegQueryInfoKey(hSubKey
, 0, 0, 0, &dwSubCount
, 0, 0, 0, 0, 0, 0, 0) != ERROR_SUCCESS
) {
257 RegCloseKey(hSubKey
);
260 AddEntryToTree(hwndTV
, hItem
, Name
, NULL
, dwSubCount
);
267 SendMessage(hwndTV
, TVM_SORTCHILDREN
, 0, (LPARAM
) hItem
);
273 HeapFree(GetProcessHeap(), 0, pszNodes
);
275 HeapFree(GetProcessHeap(), 0, Name
);
279 BOOL
RefreshTreeView(HWND hwndTV
)
282 HTREEITEM hSelectedItem
;
285 hSelectedItem
= TreeView_GetSelection(hwndTV
);
286 hcursorOld
= SetCursor(LoadCursor(NULL
, IDC_WAIT
));
287 SendMessage(hwndTV
, WM_SETREDRAW
, FALSE
, 0);
289 hItem
= TreeView_GetChild(hwndTV
, TreeView_GetRoot(hwndTV
));
291 RefreshTreeItem(hwndTV
, hItem
);
292 hItem
= TreeView_GetNextSibling(hwndTV
, hItem
);
295 SendMessage(hwndTV
, WM_SETREDRAW
, TRUE
, 0);
296 SetCursor(hcursorOld
);
298 /* We reselect the currently selected node, this will prompt a refresh of the listview. */
299 (void)TreeView_SelectItem(hwndTV
, hSelectedItem
);
303 HTREEITEM
InsertNode(HWND hwndTV
, HTREEITEM hItem
, LPTSTR name
)
305 TCHAR buf
[MAX_NEW_KEY_LEN
];
306 HTREEITEM hNewItem
= 0;
309 /* Default to the current selection */
312 hItem
= TreeView_GetSelection(hwndTV
);
317 memset(&item
, 0, sizeof(item
));
319 item
.mask
= TVIF_CHILDREN
| TVIF_HANDLE
| TVIF_STATE
;
320 if (!TreeView_GetItem(hwndTV
, &item
))
323 if ((item
.state
& TVIS_EXPANDEDONCE
) && (item
.cChildren
> 0))
325 hNewItem
= AddEntryToTree(hwndTV
, hItem
, name
, 0, 0);
326 SendMessage(hwndTV
, TVM_SORTCHILDREN
, 0, (LPARAM
) hItem
);
330 item
.mask
= TVIF_CHILDREN
| TVIF_HANDLE
;
333 if (!TreeView_SetItem(hwndTV
, &item
))
337 (void)TreeView_Expand(hwndTV
, hItem
, TVE_EXPAND
);
340 for(hNewItem
= TreeView_GetChild(hwndTV
, hItem
); hNewItem
; hNewItem
= TreeView_GetNextSibling(hwndTV
, hNewItem
))
342 item
.mask
= TVIF_HANDLE
| TVIF_TEXT
;
343 item
.hItem
= hNewItem
;
345 item
.cchTextMax
= COUNT_OF(buf
);
346 if (!TreeView_GetItem(hwndTV
, &item
)) continue;
347 if (lstrcmp(name
, item
.pszText
) == 0) break;
350 if (hNewItem
) (void)TreeView_SelectItem(hwndTV
, hNewItem
);
355 HWND
StartKeyRename(HWND hwndTV
)
359 if(!(hItem
= TreeView_GetSelection(hwndTV
))) return 0;
360 return TreeView_EditLabel(hwndTV
, hItem
);
363 static BOOL
InitTreeViewItems(HWND hwndTV
, LPTSTR pHostName
)
366 TVINSERTSTRUCT tvins
;
369 tvi
.mask
= TVIF_TEXT
| TVIF_IMAGE
| TVIF_SELECTEDIMAGE
| TVIF_CHILDREN
| TVIF_PARAM
;
370 /* Set the text of the item. */
371 tvi
.pszText
= pHostName
;
372 tvi
.cchTextMax
= lstrlen(tvi
.pszText
);
373 /* Assume the item is not a parent item, so give it an image. */
374 tvi
.iImage
= Image_Root
;
375 tvi
.iSelectedImage
= Image_Root
;
377 /* Save the heading level in the item's application-defined data area. */
378 tvi
.lParam
= (LPARAM
)NULL
;
380 tvins
.hInsertAfter
= (HTREEITEM
)TVI_FIRST
;
381 tvins
.hParent
= TVI_ROOT
;
382 /* Add the item to the tree view control. */
383 if (!(hRoot
= TreeView_InsertItem(hwndTV
, &tvins
))) return FALSE
;
385 if (!AddEntryToTree(hwndTV
, hRoot
, _T("HKEY_CLASSES_ROOT"), HKEY_CLASSES_ROOT
, 1)) return FALSE
;
386 if (!AddEntryToTree(hwndTV
, hRoot
, _T("HKEY_CURRENT_USER"), HKEY_CURRENT_USER
, 1)) return FALSE
;
387 if (!AddEntryToTree(hwndTV
, hRoot
, _T("HKEY_LOCAL_MACHINE"), HKEY_LOCAL_MACHINE
, 1)) return FALSE
;
388 if (!AddEntryToTree(hwndTV
, hRoot
, _T("HKEY_USERS"), HKEY_USERS
, 1)) return FALSE
;
389 if (!AddEntryToTree(hwndTV
, hRoot
, _T("HKEY_CURRENT_CONFIG"), HKEY_CURRENT_CONFIG
, 1)) return FALSE
;
391 if (GetVersion() & 0x80000000)
393 /* Win9x specific key */
394 if (!AddEntryToTree(hwndTV
, hRoot
, _T("HKEY_DYN_DATA"), HKEY_DYN_DATA
, 1)) return FALSE
;
397 /* expand and select host name */
398 (void)TreeView_Expand(hwndTV
, hRoot
, TVE_EXPAND
);
399 (void)TreeView_Select(hwndTV
, hRoot
, TVGN_CARET
);
405 * InitTreeViewImageLists - creates an image list, adds three bitmaps
406 * to it, and associates the image list with a tree view control.
407 * Returns TRUE if successful, or FALSE otherwise.
408 * hwndTV - handle to the tree view control.
410 static BOOL
InitTreeViewImageLists(HWND hwndTV
)
412 HIMAGELIST himl
; /* handle to image list */
413 HICON hico
; /* handle to icon */
415 /* Create the image list. */
416 if ((himl
= ImageList_Create(GetSystemMetrics(SM_CXSMICON
),
417 GetSystemMetrics(SM_CYSMICON
),
418 ILC_MASK
| ILC_COLOR32
,
425 /* Add the open file, closed file, and document bitmaps. */
426 hico
= LoadImage(hInst
,
427 MAKEINTRESOURCE(IDI_OPEN_FILE
),
429 GetSystemMetrics(SM_CXSMICON
),
430 GetSystemMetrics(SM_CYSMICON
),
434 Image_Open
= ImageList_AddIcon(himl
, hico
);
438 hico
= LoadImage(hInst
,
439 MAKEINTRESOURCE(IDI_CLOSED_FILE
),
441 GetSystemMetrics(SM_CXSMICON
),
442 GetSystemMetrics(SM_CYSMICON
),
446 Image_Closed
= ImageList_AddIcon(himl
, hico
);
450 hico
= LoadImage(hInst
,
451 MAKEINTRESOURCE(IDI_ROOT
),
453 GetSystemMetrics(SM_CXSMICON
),
454 GetSystemMetrics(SM_CYSMICON
),
458 Image_Root
= ImageList_AddIcon(himl
, hico
);
462 /* Fail if not all of the images were added. */
463 if (ImageList_GetImageCount(himl
) < NUM_ICONS
)
465 ImageList_Destroy(himl
);
469 /* Associate the image list with the tree view control. */
470 (void)TreeView_SetImageList(hwndTV
, himl
, TVSIL_NORMAL
);
475 BOOL
OnTreeExpanding(HWND hwndTV
, NMTREEVIEW
* pnmtv
)
477 DWORD dwCount
, dwIndex
, dwMaxSubKeyLen
;
478 HKEY hRoot
, hNewKey
, hKey
;
484 static int expanding
;
485 if (expanding
) return FALSE
;
486 if (pnmtv
->itemNew
.state
& TVIS_EXPANDEDONCE
) {
490 hcursorOld
= SetCursor(LoadCursor(NULL
, IDC_WAIT
));
491 SendMessage(hwndTV
, WM_SETREDRAW
, FALSE
, 0);
493 keyPath
= GetItemPath(hwndTV
, pnmtv
->itemNew
.hItem
, &hRoot
);
494 if (!keyPath
) goto done
;
497 errCode
= RegOpenKeyEx(hRoot
, keyPath
, 0, KEY_READ
, &hNewKey
);
498 if (errCode
!= ERROR_SUCCESS
) goto done
;
503 errCode
= RegQueryInfoKey(hNewKey
, 0, 0, 0, &dwCount
, &dwMaxSubKeyLen
, 0, 0, 0, 0, 0, 0);
504 if (errCode
!= ERROR_SUCCESS
) goto done
;
505 dwMaxSubKeyLen
++; /* account for the \0 terminator */
506 Name
= HeapAlloc(GetProcessHeap(), 0, dwMaxSubKeyLen
* sizeof(TCHAR
));
507 if (!Name
) goto done
;
509 for (dwIndex
= 0; dwIndex
< dwCount
; dwIndex
++) {
510 DWORD cName
= dwMaxSubKeyLen
, dwSubCount
;
512 errCode
= RegEnumKeyEx(hNewKey
, dwIndex
, Name
, &cName
, 0, 0, 0, 0);
513 if (errCode
!= ERROR_SUCCESS
) continue;
514 errCode
= RegOpenKeyEx(hNewKey
, Name
, 0, KEY_QUERY_VALUE
, &hKey
);
515 if (errCode
== ERROR_SUCCESS
) {
516 errCode
= RegQueryInfoKey(hKey
, 0, 0, 0, &dwSubCount
, 0, 0, 0, 0, 0, 0, 0);
519 if (errCode
!= ERROR_SUCCESS
) dwSubCount
= 0;
520 AddEntryToTree(hwndTV
, pnmtv
->itemNew
.hItem
, Name
, NULL
, dwSubCount
);
523 SendMessage(hwndTV
, TVM_SORTCHILDREN
, 0, (LPARAM
)pnmtv
->itemNew
.hItem
);
525 RegCloseKey(hNewKey
);
526 HeapFree(GetProcessHeap(), 0, Name
);
529 SendMessage(hwndTV
, WM_SETREDRAW
, TRUE
, 0);
530 SetCursor(hcursorOld
);
537 BOOL
CreateNewKey(HWND hwndTV
, HTREEITEM hItem
)
539 TCHAR szNewKeyFormat
[128];
546 BOOL bSuccess
= FALSE
;
550 pszKeyPath
= GetItemPath(g_pChildWnd
->hTreeWnd
, hItem
, &hRootKey
);
551 if (RegOpenKey(hRootKey
, pszKeyPath
, &hKey
) != ERROR_SUCCESS
)
554 if (LoadString(hInst
, IDS_NEW_KEY
, szNewKeyFormat
, sizeof(szNewKeyFormat
) / sizeof(szNewKeyFormat
[0])) <= 0)
557 /* Need to create a new key with a unique name */
560 _sntprintf(szNewKey
, sizeof(szNewKey
) / sizeof(szNewKey
[0]), szNewKeyFormat
, iIndex
++);
561 RegCreateKeyEx(hKey
, szNewKey
, 0, NULL
, 0, KEY_ALL_ACCESS
, NULL
, &hNewKey
, &dwDisposition
);
562 if (hNewKey
&& (dwDisposition
== REG_OPENED_EXISTING_KEY
))
564 RegCloseKey(hNewKey
);
570 /* Insert the new key */
571 hNewItem
= InsertNode(hwndTV
, hItem
, szNewKey
);
575 /* The new key's name is probably not appropriate yet */
576 (void)TreeView_EditLabel(hwndTV
, hNewItem
);
584 RegCloseKey(hNewKey
);
590 * CreateTreeView - creates a tree view control.
591 * Returns the handle to the new control if successful, or NULL otherwise.
592 * hwndParent - handle to the control's parent window.
594 HWND
CreateTreeView(HWND hwndParent
, LPTSTR pHostName
, HMENU id
)
599 /* Get the dimensions of the parent window's client area, and create the tree view control. */
600 GetClientRect(hwndParent
, &rcClient
);
601 hwndTV
= CreateWindowEx(WS_EX_CLIENTEDGE
, WC_TREEVIEW
, NULL
,
602 WS_VISIBLE
| WS_CHILD
| WS_TABSTOP
| TVS_HASLINES
| TVS_HASBUTTONS
| TVS_LINESATROOT
| TVS_EDITLABELS
,
603 0, 0, rcClient
.right
, rcClient
.bottom
,
604 hwndParent
, id
, hInst
, NULL
);
605 /* Initialize the image list, and add items to the control. */
606 if (!InitTreeViewImageLists(hwndTV
) || !InitTreeViewItems(hwndTV
, pHostName
)) {
607 DestroyWindow(hwndTV
);
613 void DestroyTreeView() {
615 HeapFree(GetProcessHeap(), 0, pathBuffer
);
618 BOOL
SelectNode(HWND hwndTV
, LPCTSTR keyPath
)
620 HTREEITEM hRoot
, hItem
;
621 HTREEITEM hChildItem
;
622 TCHAR szPathPart
[128];
627 /* Total no-good hack */
628 if (!_tcsncmp(keyPath
, _T("My Computer\\"), 12))
631 hRoot
= TreeView_GetRoot(hwndTV
);
636 s
= _tcschr(keyPath
, TEXT('\\'));
637 lstrcpyn(szPathPart
, keyPath
, s
? s
- keyPath
+ 1 : _tcslen(keyPath
) + 1);
639 /* Special case for root to expand root key abbreviations */
642 if (!_tcscmp(szPathPart
, TEXT("HKCR")))
643 _tcscpy(szPathPart
, TEXT("HKEY_CLASSES_ROOT"));
644 else if (!_tcscmp(szPathPart
, TEXT("HKCU")))
645 _tcscpy(szPathPart
, TEXT("HKEY_CURRENT_USER"));
646 else if (!_tcscmp(szPathPart
, TEXT("HKLM")))
647 _tcscpy(szPathPart
, TEXT("HKEY_LOCAL_MACHINE"));
648 else if (!_tcscmp(szPathPart
, TEXT("HKU")))
649 _tcscpy(szPathPart
, TEXT("HKEY_USERS"));
650 else if (!_tcscmp(szPathPart
, TEXT("HKCC")))
651 _tcscpy(szPathPart
, TEXT("HKEY_CURRENT_CONFIG"));
652 else if (!_tcscmp(szPathPart
, TEXT("HKDD")))
653 _tcscpy(szPathPart
, TEXT("HKEY_DYN_DATA"));
656 for (hChildItem
= TreeView_GetChild(hwndTV
, hItem
); hChildItem
;
657 hChildItem
= TreeView_GetNextSibling(hwndTV
, hChildItem
))
659 memset(&tvi
, 0, sizeof(tvi
));
660 tvi
.hItem
= hChildItem
;
661 tvi
.mask
= TVIF_TEXT
| TVIF_CHILDREN
;
662 tvi
.pszText
= szBuffer
;
663 tvi
.cchTextMax
= sizeof(szBuffer
) / sizeof(szBuffer
[0]);
665 (void)TreeView_GetItem(hwndTV
, &tvi
);
667 if (!_tcscmp(szBuffer
, szPathPart
))
674 if (tvi
.cChildren
> 0)
676 if (!TreeView_Expand(hwndTV
, hChildItem
, TVE_EXPAND
))
680 keyPath
= s
? s
+ 1 : _T("");
684 (void)TreeView_SelectItem(hwndTV
, hItem
);
685 (void)TreeView_EnsureVisible(hwndTV
, hItem
);