Article ID: 179364 - Last Review: November 21, 2006 - Revision: 1.3 How To Determine if File Extension Should Be Shown for a FileThis article was previously published under Q179364 On This PageSUMMARY
Windows 95 and Windows NT do not provide any way to determine if a user has
globally turned off the display of file extensions in Windows Explorer. To
find out if an extension should be displayed on a file-by-file basis, you
can use the APIs GetFileTitle() or SHGetFileInfo() to get the proper
display name of a file. In either case, the API will give the title of the
file properly formatted for display. If the user has requested that file
extensions be displayed for that file type, then it will have an extension.
Otherwise, it will not.
NOTE: If you have Internet Explorer 4.0 or greater installed, you can use the SHGetSettings API to determine if the user has specified that file extensions be displayed. However, if your application is displaying file names, you should use the method outlined in this article to get the proper display name for a file. MORE INFORMATION
The following code demonstrates how to use GetFileTitle() to retrieve the
appropriate display name of a file:
Sample Code | Article Translations
|


Back to the top
