Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 464
  • Last Modified:

Getting FileType with MFC

I recently started using c++ with MFC, but I can't find all the functions that the api has.
I usually used the SHGetFileInfo with the SHGFI_TYPENAME argument to receive the filetype before I began with MFC.

Now I use the CFileFind class to locate files on the harddisk, it works fine, but I can't find any function that receives the FileType... I've searched for other classes like the CFile but with no succeed.

how do I receive the filetype description of a file?
0
Marshow
Asked:
Marshow
1 Solution
 
TriskelionCommented:
Can you give me an example of what you mean by file type?
0
 
MarshowAuthor Commented:
A description of the extension like "Winamp media file" or "Textdocument" or "WinRAR ZIP Archive".
0
 
naveenkohliCommented:
There is no function in MFC that is going to return this information. You will have to use the SHell function that you have been using previously.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
DanRollinsCommented:
>>I usually used the SHGetFileInfo with the SHGFI_TYPENAME argument to receive the filetype before I began with MFC.

Why did you stop using it?  All Win32 API fns are availabe in MFC.  Example:

  SHFILEINFO rInfo;
  SHGetFileInfo( "*.ZIP", 0, &rInfo, sizeof(rInfo), SHGFI_TYPENAME );

  MessageBox( rInfo.szTypeName, "The type is..." );

-- Dan
0
 
MarshowAuthor Commented:
aha, ok, I thought that all api functions was included within the MFC.
0
 
DanRollinsCommented:
You were correct before: All Win32 API functions are included in MFC.

-- Dan
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now