CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: File Type

  1. #1
    Join Date
    Jul 2001
    Location
    Pune-India
    Posts
    251

    File Type

    Hi Gurus
    This is bit silly question ...
    How to get the file type from Windows system ?. i.e When the file contains .txt extension then sys shows it as "TXT File", for Gif image it shows "GIF Image". for ini file "Confogration Settings" etc.
    How to retrive this data from OS.

    Thanx in advance.
    Regards
    Nagesh

  2. #2
    Join Date
    Dec 2002
    Posts
    287
    SHGetFileInfo:

    DWORD_PTR SHGetFileInfo(LPCTSTR pszPath,
    DWORD dwFileAttributes,
    SHFILEINFO *psfi,
    UINT cbFileInfo,
    UINT uFlags
    );


    Look at the SHGFI_TYPENAME:

    SHGFI_TYPENAME
    Retrieve the string that describes the file's type. The string is copied to the szTypeName member of the structure specified in psfi.


    http://msdn.microsoft.com/library/de...etfileinfo.asp

    Dan

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured