Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Reading from the clipboard and writing as bitmap.

Posted on 1998-08-26
7
Medium Priority
?
343 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
Independent Software Vendors: 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!

 

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 300 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

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…
This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
The goal of this video is to provide viewers with basic examples to understand how to use strings and some functions related to them in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use nested-loops in the C programming language.

704 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