Solved

Reading from the clipboard and writing as bitmap.

Posted on 1998-08-26
7
340 Views
Last Modified: 2012-05-04
Can anyone help me do some clipboard work. I have successfully exported a chart to the clipboard but I can't seem to read from the clipboard to save it as a bmp file.
Any help would be appreciated ASAP. Thanks
0
Comment
Question by:Keele
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 2

Expert Comment

by:duneram
ID: 1252321
If its truly in the clipboard, you can start up mspaint and then just do an "Edit | Paste".

You can use this as a check to your code.  If you can do it by hand, then you know you have an error in your code.  If you cannot, then you didn't really have the data in the clipboard.
0
 

Author Comment

by:Keele
ID: 1252322
Actually, It truly is in the clipboard. I am running NT 4.0 and I used the Clipboard viewer to check and it is there. The problem is that this program must automatically do this because it will be unattended. But the picture is in the clipboard. But it is not in bmp format. I need to get it from the clipboard and write it as a bmp file.
Thanks
0
 
LVL 2

Expert Comment

by:duneram
ID: 1252323
Thats good, well you will need then to load it to a buffer and then make an image out of it.  When the data is in the clipboard, what format is it in there?
0
[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

 

Author Comment

by:Keele
ID: 1252324
I exported the picture as a bitmap to the clipboard. I am assumming that, since that is what I exported it as, it would still be in that format while it is pasted. I don't have any idea how to interact with the clipboard though. I need to know how to get something from the clipboard. I am using chartfx api call to export it but there isn't anyway of bringing it back in the api. *shrug*
0
 
LVL 2

Accepted Solution

by:
duneram earned 100 total points
ID: 1252325
ChartFX is a good toolset.  I've used it and liked it a lot!!


there are a bunch of clipboard API's

One of them is called GetClipboardData and it accepts the use of CF_BITMAP ... You can use it to retrieve clipboard data.

But you have to open a clipboard first:

BOOL OpenClipboard(  HWND hWndNewOwner   // handle to window opening clipboard);

YOu should try looking up help on any of these API's (windows)

Clipboard Functions
Following are the functions used with the clipboard.

 
 
ChangeClipboardChain  
CloseClipboard  
CountClipboardFormats  
EmptyClipboard  
EnumClipboardFormats  
GetClipboardData  
GetClipboardFormatName  
GetClipboardOwner  
GetClipboardSequenceNumber  
GetClipboardViewer  
GetOpenClipboardWindow  
GetPriorityClipboardFormat  
IsClipboardFormatAvailable  
OpenClipboard  
RegisterClipboardFormat  
SetClipboardData  
SetClipboardViewer  


 


0
 

Author Comment

by:Keele
ID: 1252326
Thanks, Duneram, but I still need a way to save it as a bmp File. You have helped greatly in the clipboard area. Now I need to know how to save it in a file. If you can provide me with that i would appreciate it greatly.
0
 
LVL 2

Expert Comment

by:duneram
ID: 1252327
Microsoft has a 'dibapi.dll' which you can download to do this sort of stuff.  Additionally get your hands on article Q97193  available from microsoft at:

http://support.microsoft.com/support/kb/articles/q97/1/93.asp

Its got sample code on how to save stuff to bitmap files.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preface I don't like visual development tools that are supposed to write a program for me. Even if it is Xcode and I can use Interface Builder. Yes, it is a perfect tool and has helped me a lot, mainly, in the beginning, when my programs were small…
Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use for-loops in the C programming language.
The goal of this video is to provide viewers with basic examples to understand opening and reading files in the C programming language.

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question