Solved

Getting FileType with MFC

Posted on 2001-08-08
6
455 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
Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

 
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

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

821 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