コード例 #1
0
        private Icon GetFileIcon(string name)
        {
            Icon result;

            try
            {
                ComposeForm.Shell32.SHFILEINFO sHFILEINFO = default(ComposeForm.Shell32.SHFILEINFO);
                uint uFlags = 273u;
                ComposeForm.Shell32.SHGetFileInfo(name, 128u, ref sHFILEINFO, (uint)Marshal.SizeOf(sHFILEINFO), uFlags);
                Icon icon = (Icon)Icon.FromHandle(sHFILEINFO.hIcon).Clone();
                ComposeForm.User32.DestroyIcon(sHFILEINFO.hIcon);
                result = icon;
            }
            catch
            {
                result = ResManager.GetIcon("attach");
            }
            return(result);
        }
コード例 #2
0
 public static extern IntPtr SHGetFileInfo(string pszPath, uint dwFileAttributes, ref ComposeForm.Shell32.SHFILEINFO psfi, uint cbFileInfo, uint uFlags);