Solved

Reading from the clipboard and writing as bitmap.

Posted on 1998-08-26
7
337 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
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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

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

ScreenConnect 6.0 Free Trial

Check out the updates in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI that improves session organization and overall user experience. See the enhancements for yourself!

Question has a verified solution.

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

Suggested Solutions

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…
Examines three attack vectors, specifically, the different types of malware used in malicious attacks, web application attacks, and finally, network based attacks.  Concludes by examining the means of securing and protecting critical systems and inf…
The goal of this video is to provide viewers with basic examples to understand recursion in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use while-loops in the C programming language.

821 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