Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

soconne

macrumors newbie
Original poster
Oct 28, 2007
9
0
Does anybody know how to capture the current desktop screen contents to an image using C++ and Carbon?
 
Does anybody know how to capture the current desktop screen contents to an image using C++ and Carbon?

I'm not sure, but I would guess that you can send a key press event and the system will handle it (since shift-apple-3 takes the screenshot already).
 
If you can use 10.5 use the new CGWindowListCreateImage API.

Its a procedural C API so you can use it in C++ Carbon apps just fine. There is some sample code from Apple called "SonOfGrab" that shows how to use it, but in a Cocoa context (mostly for dealing with saving the image to a file easier).
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.