Solved

Getting FileType with MFC

Posted on 2001-08-08
6
449 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
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.

911 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

16 Experts available now in Live!

Get 1:1 Help Now