CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6

Threaded View

  1. #1
    Join Date
    Mar 2002
    Location
    Chicago, IL
    Posts
    255

    CFileDialog: Getting true selected files.

    Hello all -

    I have a class derived from CFileDialog, and I want to do some processing of user-selected files as the selections change. In my class, I override the OnFileNameOK, OnFileNameChange, and OnFolderChange methods to get the new list of selected files (full paths). I can't rely on CFileDialog's GetFileName or GetPathName/GetNextPathName to get this list of files, because 1) even when the user clears the selection, these still return the previously-selected values, and 2) I need to be able to tell the difference between folders and files.

    So I'm trying to go the COM route. I have a small helper class that tries to do the dirty work for me. In the overrides of the methods above, I call GetSelectedFiles on the member instance of this helper I create in my dialog's constructor. This works great, however I've found that if the user clicks the Libraries shortcut on the left, then goes into Documents, it doesn't seem to work. The GetFolderPath called from the helper returns an empty string (when I'd expect it to return some symbolic string at least that other COM methods would know how to interpret). Interestingly enough, if I create a subfolder and navigate into it, I can get the selected files.

    I'd consider myself less than a novice at COM, so any help would be appreciated. Please see my attached helper.
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured