Solved

Getting FileType with MFC

Posted on 2001-08-08
6
460 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

 
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

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

Question has a verified solution.

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

Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
In this post we will learn different types of Android Layout and some basics of an Android App.
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.
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

622 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