G
Guest
Hello All,
Before I post a console app that demonstrates this problem, can anybody see
any problems with what I am doing below?
private string GetFileType(string Path)
{
SHFILEINFO shfi = new SHFILEINFO();
int cbFileInfo = Marshal.SizeOf(shfi);
uint dwflag = (uint) (SHGFI.SHGFI_TYPENAME |
SHGFI.SHGFI_USEFILEATTRIBUTES);
uint dwAttr = FILE_ATTRIBUTE_NORMAL;
IntPtr hr = SHGetFileInfo(Path, dwAttr, ref shfi, (uint)
Marshal.SizeOf(shfi), dwflag);
return shfi.szTypeName;
}
I always get a blank szTypeName.
Note: If I add the SHGFI.SHGFI_DISPLAYNAME flag, I get the first letter of
the name in the szDisplayName field.
It's probably something obvious, but not to me! : )
Thanks,
PAGates
Before I post a console app that demonstrates this problem, can anybody see
any problems with what I am doing below?
private string GetFileType(string Path)
{
SHFILEINFO shfi = new SHFILEINFO();
int cbFileInfo = Marshal.SizeOf(shfi);
uint dwflag = (uint) (SHGFI.SHGFI_TYPENAME |
SHGFI.SHGFI_USEFILEATTRIBUTES);
uint dwAttr = FILE_ATTRIBUTE_NORMAL;
IntPtr hr = SHGetFileInfo(Path, dwAttr, ref shfi, (uint)
Marshal.SizeOf(shfi), dwflag);
return shfi.szTypeName;
}
I always get a blank szTypeName.
Note: If I add the SHGFI.SHGFI_DISPLAYNAME flag, I get the first letter of
the name in the szDisplayName field.
It's probably something obvious, but not to me! : )
Thanks,
PAGates