|
-
December 6th, 2010, 03:40 PM
#1
CFileDialog - access to folder view interface
Hello all -
I have a custom CFileDialog, and I need to perform some operations when the selection changes. I override the OnFileNameOK, OnFileNameChange, and OnFolderChange methods, and in all cases get the list of selected files. Because there's no good way to do this, I call 'GetFileName()' to get the list, and do some parsing. This seems to work alright as long as the user selects only files. However if the user clicks off in the empty area of the list (clearing the selection) or selects a folder, GetFileName returns the previously-selected files instead of the current selections (which I'd expect to be an empty string in the case where no file was selected).
I could get a pointer to the underlying CListCtrl object and iterate the selections, but that has its own set of problems (For one, I'd have to build the full path then try to determine whether a folder or file was selected. For two, if the user his hiding extensions of known types, then I wouldn't know what to do with the files). I've done some research and found this article (http://msdn.microsoft.com/en-us/magazine/cc301466.aspx), but his solution isn't complete, as it doesn't work for the hidden file extensions.
All of this makes me think there should be a way to access the actual shell interface of the list and use some proper interface methods, however I'm not very familiar with that stuff. Can I get an IFolderView2 pointer to the SHELLDLL_DefView object in the CFileDialog and maybe call 'GetSelection' on that interface? If so, can someone provide some sample code?
Thanks in advance for any thoughts on this.
- Steve
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|