Solved

Getting FileType with MFC

Posted on 2001-08-08
6
446 Views
Last Modified: 2013-11-20
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
Comment
Question by:Marshow
6 Comments
 
LVL 6

Expert Comment

by:Triskelion
ID: 6365927
Can you give me an example of what you mean by file type?
0
 

Author Comment

by:Marshow
ID: 6365960
A description of the extension like "Winamp media file" or "Textdocument" or "WinRAR ZIP Archive".
0
 
LVL 23

Accepted Solution

by:
naveenkohli earned 100 total points
ID: 6366224
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
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
LVL 49

Expert Comment

by:DanRollins
ID: 6366382
>>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
 

Author Comment

by:Marshow
ID: 6367492
aha, ok, I thought that all api functions was included within the MFC.
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 6371067
You were correct before: All Win32 API functions are included in MFC.

-- Dan
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now