|
Simulating print Screen functions |
Phoenix_256
Member #8,316
February 2007
|
Heya, I want to write a program that startup takes a screenshot of what ever is on the screen to use as a background within the program. I've already found the fantastic code to get a bitmap from the clipboard, so I thought that using 'simulate_key(KEY_PRTSCR);' would copy it to the clipboard, but Windows doesn't accept the key press (it ignores it) I guess that simulate_key simply sets that keys flag to true, but what I'd like to find out is; is there another way to capture the screen image? I've included the code below. Cheers Phoenix
|
Andrei Ellman
Member #3,434
April 2003
|
Allegro does not provide a way to grab an image of the desktop. Each operating system has a different means of accessing the desktop image. For Windows, you might want to look at the sourcecode for ChromaPlas to see how it's done on Windows. AE. -- |
Jakub Wasilewski
Member #3,653
June 2003
|
Basically, you would use GetDC(NULL) to get a HDC for the entire screen. Then, you can use Windows specific Allegro functions, described here in the manual. Specifically, you want blit_from_hdc. If you want to use that, be sure to include winalleg.h. --------------------------- |
ImLeftFooted
Member #3,935
October 2003
|
Grabbing a picture of the desktop is no longer possible for screen savers as of XP. |
BAF
Member #2,981
December 2002
|
But you can grab a screenshot in a screen saver, right? |
Andrei Ellman
Member #3,434
April 2003
|
Dustin Dettmer said: Grabbing a picture of the desktop is no longer possible for screen savers as of XP. Is that only as of XP SP2? I could have sworn I've gotten ChromaPlas in desptop-image mode to work on an XP-based machine. Even if it were true, it would be a pity, as it would prevent the many screensavers that maipulate the desktop image from working. AE. -- |
|