C#怎样提取.Exe.dll文件的图标?

来源:百度知道 编辑:UC知道 时间:2024/07/07 06:26:27
用.net或api都可以。
要有源码的。

SHFILEINFO shinfo = new SHFILEINFO();
//Use this to get the small Icon
Win32.SHGetFileInfo(fileName, 0, ref shinfo,(uint)Marshal.SizeOf(shinfo),Win32.SHGFI_ICON|Win32.SHGFI_SMALLICON);
//The icon is returned in the hIcon member of the shinfo struct
System.Drawing.Icon myIcon = System.Drawing.Icon.FromHandle(shinfo.hIcon);
return myIcon;