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
Solved

Writing file from clipboard

Posted on 2000-03-19
4
234 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
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.

856 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