Click to See Complete Forum and Search --> : Clipboard manipulation of graphic data.


zaxonus
November 27th, 2006, 03:59 AM
Hello,

I need some help for clipboard manipulation of graphic data.

Can anybody help me on the following problem ?

I have graphic data in the clipboard (in ENHMETAFILE format).

I can get it using the following line of code :
HENHMETAFILE handle = (HENHMETAFILE)GetClipboardData(CF_ENHMETAFILE);

Then I can display it. I am therefore sure that I get it.

How can I save this data as a .bmp file or even better as a .jpg file ?

I looked on the internet for code samples using CBitmap, but some pieces are still missing.
I am not a "graphic programmer", but this has to be possible in a way or another.

Thanks for any help.

VladimirF
November 27th, 2006, 07:01 PM
I don't know much about metafiles, but since you said you can draw it to some DC, I would try to first select a compatible bitmap into that DC, then play your metafaile - and that bitmap object should now have a picture from metafile.
Saving it to a bmp file should be simple. For jpg you would need to use some library. There is an open source one here (http://www.ijg.org/)

zaxonus
November 29th, 2006, 12:20 AM
I follow your idea. But how do I do that ?
I don't know much about playing with DCs and CBitmaps and all this.
All I have tried gave me only a whole black or whole white bitmap in a file as a result.
I must be doing things in the wrong order (or even doing the wrong thing).