mfc - How can I get file extension description through CFileDialog -
The cylinder dialeg file dialog (wrong, // we save as file dialog. _T ("*. TXT "), // Save as default format. _T (" Hello "), OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, _T (" text files (*. *) | * .txt | Excel files (* .xls) | * .xls | Excel description files | (* .xls) || "), this); // returns "xls" to me Const CString File Extension = fileDialog.GetFileExt (); // give me "excel files" or "excel details files" ???
What is the correct way to get file extension details for me?
Are you trying to retrieve the details you sent to the API ...? You can retrieve it from the internal OPENFILENAME structure by using Member CFileDialog :: GetOFN and you can see the lpstrFilter member of the structure, but you have to manually purge the string.
But API SHGetFileInfo should be able to recover registered file type details for operating system. Pass the "* .xls" (or the extension you want) to pass it nearby.
Comments
Post a Comment