无法获得“我的电脑"图标使用SHGetFileInfo的特殊文件夹 [英] Can't get icon for "My Computer" special folder using SHGetFileInfo

查看:258
本文介绍了无法获得“我的电脑"图标使用SHGetFileInfo的特殊文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用SHGetFileInfo来获取文件夹图标.除调用我的电脑"特殊文件夹-CLSID ::{20D04FE0-3AEA-1069-A2D8-08002B30309D}上的SHGetFileInfo之外,所有其他方法都工作正常.对于该特定情况,在调用SHGetFileInfo之后,SHFILEINFO.hIcon结构具有零值.在Windows 7上会发生这种情况.早期在WinXP上,代码运行良好.

I'm using SHGetFileInfo to get folders icons. All works fine except when invoking SHGetFileInfo on "My Computer" special folder - CLSID ::{20D04FE0-3AEA-1069-A2D8-08002B30309D}. For that particular case after call to SHGetFileInfo the SHFILEINFO.hIcon struct has zero value. This happens on Windows 7. Earlier on WinXP the code worked fine.

我用来调用SHGetFileInfo的标志是SHGFI_ICONSHGFI_SMALLICON,所以没什么花哨的.

The flags I use for invoking SHGetFileInfo are SHGFI_ICON and SHGFI_SMALLICON, so nothing fancy.

这可能是什么原因?如何在Windows 7上获取我的电脑"图标?

What may be the cause of this? How can I get the "My Computer" icon on Windows 7?

推荐答案

我决定使用ExtractIconEx并直接从shell32.dll(图标索引15)读取MyComputer图标.与Win API不同,图标列表似乎没有改变:)

I've decided to use ExtractIconEx and read MyComputer icon directly from shell32.dll (icon index 15). Unlike Win API it seems that the icon lists do not change :)

这篇关于无法获得“我的电脑"图标使用SHGetFileInfo的特殊文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆