我如何将原始的RGB 24位放入剪贴板 [英] How can I put raw rgb 24bits to clipboard

查看:64
本文介绍了我如何将原始的RGB 24位放入剪贴板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

我有一个原始图像数据,其类型为rgb24(原始表示仅rgb位,没有标题或任何东西).
我想将其放入剪贴板,然后将其粘贴到MS Paint或MS office.
为此,我搜索了4天,但仍然无法创建有效的代码.
您能否在下面查看我的代码,看看我出了什么问题:

该代码片段可以运行,但是我无法将任何图像粘贴到MS PAINT.出现这样的错误消息:获取剪贴板数据时出错.
没有足够的内存或资源来完成操作.
关闭一些程序,然后重试."

对不起,我的英语不好.

<我的问题="s解决了,我使用了另一种技术.谢谢></xml>">

Hello there,

I have a raw image data which is in type rgb24 (raw means rgb bits only, no header or anything).
I want to put it into the clipboard then paste it into MS Paint or MS office.
To do this, I searched 4 days and still can not be able to make a working code.
Can you please review my code below and see where I went wrong:

This code snipset can run but I can not paste any image to MS PAINT. There is an error message like this appears "Error getting the Clipboard Data.
There is not enough memory or resources to complete operation.
Close some program and then try again".

And sorry for my bad english.

<my problem="s solved, I used another technique. Thanks ></xml>">

推荐答案

您可以随时尝试以下方法:
将DIB复制到剪贴板 [ http://www.codeguru.com/cpp/gm/bitmap/article.php/c1715 [^ ]

问候
Espen Harlinn
You can always try this:
Copying a DIB to the Clipboard[^]

You can also look at this (See Function 2: Copy a device-independent bitmap to clipboard<):
http://www.codeguru.com/cpp/g-m/bitmap/article.php/c1715[^]

Regards
Espen Harlinn


m_bi_src_.bmiHeader.biHeight = -i_height;



您的i_height是负值吗?向剪贴板添加高度为负的位图会导致MSPaint错误地计算所需的内存使用情况并报错.



Is your i_height a negative value? Adding a bitmap with negative height to the clipboard would cause MSPaint to incorrectly calculate the required memory usage and complain.


1.)CF_DIB:将整个图像标头+位图位复制到全局句柄中并放入剪贴板.
2.)CF_BITMAP:对于1.),无需创建位图对象(HBITMAP),但在此步骤中将其放入剪贴板.

目前,我不知道谁拥有手柄,请查看SetClipboardData的文档.

祝你好运.
1.) CF_DIB: copy the whole image header+bitmap bits into your global handle and put it into clipboard.
2.) CF_BITMAP: for 1.) its unnecessary to create a bitmap object (HBITMAP) but put it to the clipboard in this step.

at this this time i don''t know who owns the handles, look at documentation for SetClipboardData.

good luck.


这篇关于我如何将原始的RGB 24位放入剪贴板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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