コード例 #1
0
 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;
 }
コード例 #2
0
		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;
		}
コード例 #3
0
		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;
        }
コード例 #4
0
		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;
		}