[VB.Net] Get real filetype name from a file extension 06-22-2011, 11:08 AM
#1
Made this for a custom explorer I'm making.
Usage:
Output:
I hope somebody finds it useful. Have a nice day.
Code:
Private Function GetFileType(ByVal FileName As String) As String
GetFileType = ""
Dim extensionName As String = My.Computer.Registry.GetValue("HKEY_CLASSES_ROOT\" & FileName.Substring(FileName.LastIndexOf(".")), "", FileName.Substring(FileName.LastIndexOf(".")))
GetFileType = My.Computer.Registry.GetValue("HKEY_CLASSES_ROOT\" & extensionName, "", FileName.Substring(FileName.LastIndexOf(".")))
End SubUsage:
Code:
MsgBox(GetFileType("C:\file.txt"))Output:
Code:
Text DocumentI hope somebody finds it useful. Have a nice day.
![[Image: rytwG00.png]](http://i.imgur.com/rytwG00.png)
Redcat Revolution!




![[+]](https://sinister.li/images/modern/collapse_collapsed.png)