Solved

Writing file from clipboard

Posted on 2000-03-19
4
230 Views
Last Modified: 2013-11-20
I am capturing video and copying it to the clipboard. I would like to take the image from the clipboard and save it as a certain file (say image.jpg). I want to do this at configurable intervals (say 5 frames per second). So, from the clipboard i want to rewrite the image.jpg 5 times per second with the different images available at those times on the clipboard.
 Thanx for any help
0
Comment
Question by:vernk
  • 2
4 Comments
 
LVL 3

Expert Comment

by:ghimireniraj
ID: 2633829
comment added just to get notified
0
 
LVL 11

Expert Comment

by:mikeblas
ID: 2634030
ghimireniraj> comment added just to get notified

No need to announce that, ghimireniraj. Just leave the box blank and submit the form with the checkbox marked and you'll be added.

But, what's your question, vernk? Are you just interested in finding code that takes the data on the clipboard and writes it out to a file?

..B ekiM
0
 

Author Comment

by:vernk
ID: 2634381
B ekiM,
 Yes......I want to take the image on the clipboard and write it out to a file.....in effect overwriting the file 5x a second.
0
 
LVL 11

Accepted Solution

by:
mikeblas earned 100 total points
ID: 2647861
There's no standard Windows clipboard format for JPEG files. That's because Windows always uses bitmaps to represent graphical data. Even if the program that sources this data normally writes a JPEG file, it's still converting to a bitmap to get it drawn.

It's possible (though very unlikely--because there'd be no reason to do it!) that the program is actually putting a registered clipboard format up that contains raw JPEG data. You could get that and dump it.  But, I doubt that's what's happening. The clipboard is for exchanging data from one Windows program to another. A bitmap is far richer and more readily accepted as a target

So, your solution will be:

1) Open the clipboard

2) Get the formats. If CF_BITMAP isn't one of them, you can't get the data because it isn't in a format you can use.

3) Get the memory. Lock it. Reference it as a BITMAP structure.

4) Use a 3rd party bitmap-to-JPEG library to convert the bitmap to a JPEG

5) Write the resulting data.

I'm not really in a position to endorse products, but my favorite library for step #4 is Intel's JPEG Conversion Library. It's very fast, and quite easy to use.  Plus, it's well-supported and free.

..B ekiM
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.

707 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

16 Experts available now in Live!

Get 1:1 Help Now