C ++:第1步:ExtractIconEx。第2步: ???步骤3:SetMenuItemBitmaps

编程入门 行业动态 更新时间:2024-10-11 01:16:47
本文介绍了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 framework, no vista) is appreciated.

推荐答案

任何建议,让它工作,特别是在旧机器上(例如没有框架,没有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

本文发布于:2023-11-29 07:01:56,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1645679.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:步骤   ExtractIconEx   SetMenuItemBitmaps

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!