将HBITMAP转换为VARIANT for excel加载项(C ++) [英] Convert HBITMAP into VARIANT for excel add-in (C++)
本文介绍了将HBITMAP转换为VARIANT for excel加载项(C ++)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在Excel加载项的功能区中有一个我想要的资源位图。
我没有使用MFC或ATL。
我尝试了什么:
我使用IDispatch Invoke来调用getImage ribbon xml。
我可以返回一个字符串(VARIANT - BStr)代表一个内置的Excel图像,但我想返回一个资源Bitmap。
I have a resource bitmap that I want in the ribbon in an Excel Add-in.
I am not using MFC or ATL.
What I have tried:
I am using IDispatch Invoke for the call to getImage from ribbon xml.
I can return a string (VARIANT - BStr) representing one of the built-in Excel images but I want to return a resource Bitmap instead.
推荐答案
我只需要从资源位图创建IPictureDisp,并在Invoke中将返回的VARIANT类型设置为VT_DISPATCH,将VARIANT pdispVal值设置为IPictureDisp并将其返回给getImage函数。
I simply needed to create an IPictureDisp from the resourced bitmap and in Invoke set the returned VARIANT type to VT_DISPATCH, set the VARIANT pdispVal value to the IPictureDisp and return it for the getImage function.
这篇关于将HBITMAP转换为VARIANT for excel加载项(C ++)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文