Timothy Madden
2010-07-21 12:06:38 UTC
Hello
I want to open the last used folder in my Browse for Folder dialog, and
the problem is after I send BFFM_SETSELECTION and BFFM_SETEXPANDED
messages when the SHBrowseForFolder callback function receives
BFFM_INITIALIZED notification, the selected item is not visible in the
newly-opened directory tree.
Looks like SHBrowseForFolder finds it more important to have the root
node visible, than the selected node, and altough I have my folder
selected, the tree control needs to be scrolled to get the folder into view.
I call hWndTree = ::FindWindowEx(hWnd, NULL, WC_TREEVIEW, NULL); to get
the tree view control and than invoke
TreeView_EnsureVisible(hWndTree, TreeView_GetSelection(hWndTree));
but FindWindowEx just returns NULL.
hWnd is just the HWND paramter to SHBrowseForFolder callback function
BrowseCallbackProc, and it is valid because the other messages
(BFFM_SETSELECTION, ...) sent to the handle work.
I would not think that the tree control in the browse for folder dialog
is not really a tree-view control, so do you know why FindWindowEx fails ?
Thank you,
Timothy Madden
I want to open the last used folder in my Browse for Folder dialog, and
the problem is after I send BFFM_SETSELECTION and BFFM_SETEXPANDED
messages when the SHBrowseForFolder callback function receives
BFFM_INITIALIZED notification, the selected item is not visible in the
newly-opened directory tree.
Looks like SHBrowseForFolder finds it more important to have the root
node visible, than the selected node, and altough I have my folder
selected, the tree control needs to be scrolled to get the folder into view.
I call hWndTree = ::FindWindowEx(hWnd, NULL, WC_TREEVIEW, NULL); to get
the tree view control and than invoke
TreeView_EnsureVisible(hWndTree, TreeView_GetSelection(hWndTree));
but FindWindowEx just returns NULL.
hWnd is just the HWND paramter to SHBrowseForFolder callback function
BrowseCallbackProc, and it is valid because the other messages
(BFFM_SETSELECTION, ...) sent to the handle work.
I would not think that the tree control in the browse for folder dialog
is not really a tree-view control, so do you know why FindWindowEx fails ?
Thank you,
Timothy Madden