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

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -