Solved

Reading from the clipboard and writing as bitmap.

Posted on 1998-08-26
7
334 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
  • 4
  • 3
7 Comments
 
LVL 2

Expert Comment

by:duneram
Comment Utility
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
Comment Utility
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
Comment Utility
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
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 

Author Comment

by:Keele
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Have you thought about creating an iPhone application (app), but didn't even know where to get started? Here's how: ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Important pre-programming comments: I’ve never tri…
This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
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.
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.

771 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now