public static IntPtr getIcon(String absolutePath, Boolean getLargeIcon) { ShellApi.SHFILEINFO shinfo = new ShellApi.SHFILEINFO(); if (ShellApi.SHGetFileInfo(absolutePath, 0, out shinfo, (uint)Marshal.SizeOf(shinfo), ShellApi.SHGFI.SHGFI_ICON | (getLargeIcon ? ShellApi.SHGFI.SHGFI_LARGEICON : ShellApi.SHGFI.SHGFI_SMALLICON)) == IntPtr.Zero) { return IntPtr.Zero; } return shinfo.hIcon; }
public static int getAttribute(string path) { ShellApi.SHFILEINFO shinfo = new ShellApi.SHFILEINFO(); if (ShellApi.SHGetFileInfo(path, 0, out shinfo, (uint)Marshal.SizeOf(shinfo), ShellApi.SHGFI.SHGFI_ATTRIBUTES) == IntPtr.Zero) { return 0; } return (int)shinfo.dwAttributes; }
public static String getFolderType(IntPtr pIDL) { ShellApi.SHFILEINFO fileInfo = new ShellApi.SHFILEINFO(); ShellApi.SHGetFileInfo(pIDL, 0, out fileInfo, (uint)Marshal.SizeOf(fileInfo), ShellApi.SHGFI.SHGFI_PIDL | ShellApi.SHGFI.SHGFI_TYPENAME); return fileInfo.szTypeName; }
public static string getFolderType(string path) { ShellApi.SHFILEINFO shinfo = new ShellApi.SHFILEINFO(); if (ShellApi.SHGetFileInfo(path, 0, out shinfo, (uint)Marshal.SizeOf(shinfo), ShellApi.SHGFI.SHGFI_TYPENAME) == IntPtr.Zero) { return null; } return shinfo.szTypeName; }