Click here to Skip to main content
15,890,690 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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>">
Posted
Updated 16-Jan-11 20:53pm
v3
Comments
[no name] 17-Jan-11 3:26am    
You removed the source code and added no further comment, does that mean your problem is solved?

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
 
Share this answer
 
v2
m_bi_src_.bmiHeader.biHeight = -i_height;


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.
 
Share this answer
 
v3
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.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900