Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using print screen to capture images into a program.

Status
Not open for further replies.

Sherak

Programmer
Sep 1, 2003
83
0
0
GB
I have an application and as part of it I would like to be able to capture a image of the despktop (even if the program is minimised), I would think it will be somthing tied into the print screen function but I am at a loss at how to capture it..

Any advice is greatly appriciated....
 
What many programs do is grab the image from the clipboard. For example, when I press "print screen," the image of the desktop is put into the clipboard. I have another program that then grabs this image and puts it into its own cache.

I've also seen program intercept the "print screen" button and grab the image directly. I suspect that there are programs that do a little bit of both.



James P. Cottingham
-----------------------------------------
[sup]To determine how long it will take to write and debug a program, take your best estimate, multiply that by two, add one, and convert to the next higher units.[/sup]
 
Hi,

I had to do this recently in a program.

keybd_event(VK_SNAPSHOT, 1, 0, 0);

I believe if you swap the 1 for a 0 it will do a fullscreen capture.

Then I save it to disk

if(Clipboard()->HasFormat(CF_BITMAP))
{
Image1->Picture->Assign(Clipboard());
Image1->Picture->SaveToFile("test.bmp");
}

Hope that helps.
/Regards
TBlue
 
Thanks guys, but more importanty thanks Tremorblue, thats perfect :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top