有谁知道如何将IPictureDisp转换为Outlook图片? [英] Does anybody know how to convert a IPictureDisp to an Outlook picture?

查看:88
本文介绍了有谁知道如何将IPictureDisp转换为Outlook图片?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我创建了一个替换所有表单区域,我有一个命令按钮,我正在尝试为按钮控件设置图像。我从资源加载了ICON并创建了一个IPictureDisp。我试图用图片disp来调用_OlkCommandButton :: put_Picture方法
,这是 不工作显然我必须创建一个Picture对象,但我没有成功。这是一小段代码。

I have created a replace-all form region and I have a command button that I am trying to set an image for for a button control. I loaded the ICON from a resource and created an IPictureDisp. I am trying to call _OlkCommandButton::put_Picture method with the picture disp, which is  not working. Obviously I have to creat a Picture object and I have been unsuccessful. Here is a little snippet of code.

CComPtr < Outlook::_OlkCommandButton> m_spButton;
std::vector< CComPtr<IPictureDisp> > m_image;
.
.
.
CComPtr<IPictureDisp> spPictureDisp;
GetPictureFromIcon32x32Resource(IDI_LOGO, &spPictureDisp);
m_image.push_back(spPictureDisp);
m_spButton->put_Picture(spPictureDisp); // not working, and is expecting a Picture*

有人知道一种有效的转换方式吗?我尝试了几种方法,但都没有成功。

Does anybody know an efficient way to convert? I have tried several methods and all have been unsuccessful.

谢谢,

Tom

推荐答案

尽可能告诉IPictureDisp和PIcture是一回事。  IPictureDisp的IID是7BF80981-BF32-101A-8BBB-00AA00300CAB,根据使用oleview.exe查看的Ole Automation Ver2.0类型库(stdole2.tlb),图片调度接口
具有相同的IID。

As near as I can tell an IPictureDisp and PIcture are the same thing.  The IID for IPictureDisp is 7BF80981-BF32-101A-8BBB-00AA00300CAB and according to the Ole Automation Ver2.0 type library (stdole2.tlb) viewed with oleview.exe a Picture dispinterface has the same IID.

您应该能够简单地使用强制转换来使编译器满意。

You should be able to simply use a cast to make the compiler happy.


这篇关于有谁知道如何将IPictureDisp转换为Outlook图片?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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