现在我做的打开文件对话框,用鼠标每次只能选取一个对象,如果我想用鼠标(同时按Ctrl键)选取多个对象,该怎么做?

解决方案 »

  1.   

    CFileDialog::m_ofnFlags.Flag 
    A set of bit flags you can use to initialize the dialog box. When the dialog box returns, it sets these flags to indicate the user's input. This member can be a combination of the following flags: Flag Meaning 
    OFN_ALLOWMULTISELECT 
     Specifies that the File Name list box allows multiple selections. If you also set the OFN_EXPLORER flag, the dialog box uses the Explorer-style user interface; otherwise, it uses the old-style user interface. 
    If the user selects more than one file, the lpstrFile buffer returns the path to the current directory followed by the filenames of the selected files. The nFileOffset member is the offset, in bytes or characters, to the first filename, and the nFileExtension member is not used. For Explorer-style dialog boxes, the directory and filename strings are NULL separated, with an extra NULL character after the last filename. This format enables the Explorer-style dialogs to return long filenames that include spaces. For old-style dialog boxes, the directory and filename strings are separated by spaces and the function uses short filenames for filenames with spaces. You can use theFindFirstFile function to convert between long and short filenames. If you specify a custom template for an old-style dialog box, the definition of the File Name list box must contain the LBS_EXTENDEDSEL value. 
     
      

  2.   

    CFileDialog
    定义m_ofn.Flags为OFN_ALLOWMULTISELECT