How TO save the Clipboard's BMP data as Gif or Jpg file?

How TO save the Clipboard's BMP  data as  Gif  or Jpg file?
first ,I copy a image to Clipboard,and then I want to save these data to a Gif or Jpg file.
I need some source codes or good idea. TKS.
Who is Participating?
Have a look at GetClipboardData() function....

You need code something like following to retrieve bitmap from clipboard to DC :

         //Get the clipboard data
      HBITMAP handle = (HBITMAP)GetClipboardData(CF_BITMAP);
      CBitmap * bm = CBitmap::FromHandle(handle);

      CClientDC cdc(this);
      CDC dc;


Have a look at this sample project with src :
All you ever wanted to know about the Clipboard... <== c

Now about converting your BMP to JPG you have many options like GDI+ library or other third party libraries like CxImage etc

Have a look at this : <==

Hope This Helps.

ymq8328Author Commented:
I think this is a easy but not good method.
1,save the Clipboard's data to BMP file.
2,convert the BMP file to gif of jpg file.
I think using libJPEG standard JPG libraries will be easy way for you...

You may refer this about this libraries with src.. Following ImageHandler is A Component to Copy an HDC Area to a JPEG File : <== Refer Full Article

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

VS7 makes use of the features of GDI+ to save in various formats, including JPEG:
Why Grade 'C' ????
ymq8328Author Commented:
dear mahesh1402.
your answer can't help me  directly,I need to do a lot of other work.
thanks again.
if you want further assistance or u have not satisfied with above you may ask your quesries by posting them here......we may further comment on it to solve it.

Can I ask you what problems you had with above solution ?

ymq8328Author Commented:
U are a hot heart guy.
I have solved this problem by using other JPG lib.
I am a electronic engineer,I kown few,I  judge your answer like this.
A , I can use it directly.
B, few modify.
C,a lot of modify.
No not HOT heart..I really asked if you have really any problems with above solutions.... :)

Here we can redirect you towards right directions instead of providing  100% ready solutions or code.. So here 'C' considered as bad assist which is even not near to your problem solutions !

ymq8328Author Commented:
'C' considered as bad assist ?
No,you assistance is usefull for me.I don't kown that. sorry for this.I think I can't do this mistake.How can I remedy this?
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.