Solved

Reading from the clipboard and writing as bitmap.

Posted on 1998-08-26
7
339 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
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!

 

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

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!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
logging Access violation 6 25
C dll call freezes 5 116
how to understand recursion 12 237
Adjust the codes 3 63
Summary: This tutorial covers some basics of pointer, pointer arithmetic and function pointer. What is a pointer: A pointer is a variable which holds an address. This address might be address of another variable/address of devices/address of fu…
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.
The goal of this video is to provide viewers with basic examples to understand opening and reading files in the C programming language.

751 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