Get large icon from file extension

偶尔善良 提交于 2019-12-03 06:58:59

The code you're referencing only uses 2 sizes:

public const uint SHGFI_LARGEICON = 0x000000000;     // get large icon
public const uint SHGFI_SMALLICON = 0x000000001;     // get small icon

to get the extra_large size, you need to add your own define (and add another enum for calling functions):

public const uint SHGFI_EXTRALARGEICON = 0x000000002;     // get extra large icon

or if you just want a quick fix, replace 0x000000000 with 0x000000002 in the original large definition.

Here are all icon sizes: http://msdn.microsoft.com/en-us/library/windows/desktop/bb762185%28v=vs.85%29.aspx

You cannot make ShGetFileInfo return ExtraLarge and Jumbo icons.

Instead,

1) Call ShGetFileInfo with the SysIconIndex ( 0x000004000) flag   2) Get the System Imagelist with the proper size using ShGetImageList 3) Get the HICON using ImageList_GetIcon and the .iIcon value from SHFILEINFO.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!