An easy one I think...

BlitzPlus Forums/BlitzPlus Beginners Area/An easy one I think...

I would like to be able to capture the current image on the screen (equivlent of pressing printscreen) and save it straight to the desktop as either a jpeg (prefferred) or png. This is so simple I can't believe it hasn't been done before in Blitzplus but I can't find anything.

Anyone already done this or seen this done before?

Thanks,

Darkheart

gfxGrab = CreateImage(GAME_WIDTH, GAME_HEIGHT)
GrabImage gfxGrab,0,0
SaveImage gfxGrab, CurrentDir()+"screenshot.bmp"
FreeImage gfxGrab

I had trouble getting the print screen key recognised, don't know why, so I used an F Key in the end. Note that the code above only saves it as a bmp. Also it uses CurrentDir(). You can change this to whatever path you want but to find out the current desktop path you probably need to check the registry or call a User32.dll function. The code archives will contain code to let you do this.

Wouldnt SaveBuffer(backbuffer()) work also?

I guess so, can't remember why I did that. I think it was from a help file actually.

Sorry just to make clear I don't want to capture what's going on in the application I want to capture whatever is on the screen at the time, including Windows background, other apps etc.

Darkheart

Try saving the DesktopBuffer():
desk = DesktopBuffer()
SaveBuffer(desk,"test.bmp")


Ooh, that is good - there isn't one of those in B3D - is it different/separate to front/back buffer?

LOL I didn't think it would be *THAT* easy, thanks Beaker, that will teach me to forget to update my docpacs.

Darkheart