C ++:第1步:ExtractIconEx。第2步: ???步骤3:SetMenuItemBitmaps [英] C++: Step 1: ExtractIconEx. Step 2: ??? Step 3: SetMenuItemBitmaps

查看:233
本文介绍了C ++:第1步:ExtractIconEx。第2步: ???步骤3:SetMenuItemBitmaps的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试向shell扩展添加图标。我有这个代码(清理为容易阅读),其工作原理:

I'm experimenting with adding icons to a shell extension. I have this code (sanitized for easy reading), which works:

InsertMenu(hmenu, index, MF_POPUP|MF_BYPOSITION, (UINT)hParentMenu, namestring);

下一步是这个代码:

HICON hIconLarge, hIconSmall;
ICONINFO oIconInfo;
ExtractIconEx("c:\\progra~1\\winzip\\winzip32.exe", 0, &hIconLarge, &hIconSmall, 1);
GetIconInfo(hIconSmall, &oIconInfo);
//???????
SetMenuItemBitmaps(hParentMenu, indexMenu-1, MF_BITMAP | MF_BYPOSITION, hbmp, hbmp);

我用什么来替换?尝试谷歌这种知识发现了许多提示,我没能成功。

What do I put in to replace the ?'s. Attempts to Google this knowledge have found many tips that I failed to get working. Any advice on getting this to work, especially on older machines (e.g. no .net framework, no vista) is appreciated.

推荐答案

任何建议,让它工作,特别是在旧机器上(例如没有.net框架,没有vista)虽然背景颜色是黑色的而不是透明的,但是工作正常。

This works, though the back color is black instead of transparent.

GetIconInfo(hIconSmall, &oIconInfo);
SetMenuItemBitmaps(hmenu, uMenuIndex+i+popUpMenuCount-1, MF_BITMAP | MF_BYPOSITION, oIconInfo.hbmColor, oIconInfo.hbmColor);

这篇关于C ++:第1步:ExtractIconEx。第2步: ???步骤3:SetMenuItemBitmaps的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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