"kids_pro" <ki******@yahoo.com> wrote in message
news:Od**************@TK2MSFTNGP10.phx.gbl...
Truong Hong Thi wrote:However I can't get FileType from FileInfo I can only get File extension
What is file type? Did you mean that you want to detect if the file is
a text file or binary file?
No, for example you open My Document folder.
Change view to detail you will see column Type which tell you what is the
type of the file such as Text Document, WinZip File, Microsoft Word
Document etc.
Thanks,
kids
Here's what I did a while back...
This article will help you:
http://msdn.microsoft.com/library/de...file_types.asp
What you are looking at is essentially registered types with an associated
application. Note that although all file extensions are registered, they may
or may not have an associated application. Also, while there is a standard
for writing this information to the registry, not all application
programmers follow the standard. You will see this as you investigate the
registry.
For the basic file type: for a given file extension, read the (Default)
value of the key with the same name in the HK_Classes_Root registry. Now
read the (Default) value of the key with that name from the HK_Classes_Root
registry.
extension: .doc
HK_CLASSES_ROOT
(Default) REG_SZ Word.Document.8
HK_CLASSES_ROOT\Word.Document.8
(Default) REG_SZ Microsoft Word Document
extension: .ini
HK_CLASSES_ROOT\.ini
(Default) REG_SZ inifile
HK_CLASSES_ROOT\infile
(Default) REG_SZ Setup Information
extension: .zip
HK_CLASSES_ROOT\.zip
(Default) REG_SZ CompressedFile
HK_CLASSES_ROOT\CompressedFile
(Default) REG_SZ Compressed (zipped) Folder
Refer to the MSDN article for further information on discovering the
associated application.
Hope this helps,
-Jeff