Supermario
Member
- Joined
- Aug 23, 2003
- Messages
- 5
Hi there,
Im trying to get associate file type descriptions; for instance "music.mp3" should return "MP3 audio file (mp3)"; using SHGetFileInfo:
This code is similar to the one I use to get the icons associated with
files:
VB: http://support.microsoft.com/default.aspx?scid=kb;EN-US;319340
C#: http://support.microsoft.com/default.aspx?scid=kb;EN-US;319350
The icons works fine, but what I wanted most (AssociateType) doesnt seams to work :-(
I always get an empty string.
If you can help, I would be more than happy!
Regards,
Mario
[edit]Wahtch the language please, - Orbity[/edit]
Sure, sorry... I replaced the "bad word" with the dictionary polite synonym.
Im trying to get associate file type descriptions; for instance "music.mp3" should return "MP3 audio file (mp3)"; using SHGetFileInfo:
Code:
Imports System.Runtime.InteropServices
Private Structure SHFILEINFO
Public hIcon As IntPtr
Public iIcon As Integer
Public dwAttributes As Integer
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=260)> _
Public szDisplayName As String
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=80)> _
Public szTypeName As String
End Structure
Private Declare Auto Function SHGetFileInfo Lib "shell32.dll" _
(ByVal pszPath As String, ByVal dwFileAttributes As Integer, _
ByRef psfi As SHFILEINFO, ByVal cbFileInfo As Integer, _
ByVal uFlags As Integer) As IntPtr
Const SHGFI_TYPENAME = &H400
Private Function GetType(ByVal sPath As String) As String
Dim hImgSmall As IntPtr
Dim shinfo As New SHFILEINFO
shinfo.szDisplayName = New String(Chr(0), 260)
shinfo.szTypeName = New String(Chr(0), 80)
hImgSmall = SHGetFileInfo(sPath, 0, shinfo, _
Marshal.SizeOf(shinfo), SHGFI_TYPENAME)
Return shinfo.szTypeName
End Function
files:
VB: http://support.microsoft.com/default.aspx?scid=kb;EN-US;319340
C#: http://support.microsoft.com/default.aspx?scid=kb;EN-US;319350
The icons works fine, but what I wanted most (AssociateType) doesnt seams to work :-(
I always get an empty string.
If you can help, I would be more than happy!
Regards,
Mario
[edit]Wahtch the language please, - Orbity[/edit]
Sure, sorry... I replaced the "bad word" with the dictionary polite synonym.
Last edited by a moderator: