save buffer to pic

Blitz3D Forums/Blitz3D Beginners Area/save buffer to pic

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

I'm using the following code to save a print screen:

If KeyHit(10)
CameraViewport camera,0,0,GraphicsWidth(),GraphicsHeight()
iFileNumber% = 0
Repeat
iFileNumber = iFileNumber + 1
sFileName$ = "Pictures\Screenshot" + String$("0", 3 - Len(Str$(iFileNumber))) + iFileNumber + ".bmp"
Until Not(FileType(sFileName))
SaveBuffer BackBuffer(), sFileName
CameraViewport camera,7.5,20,GraphicsWidth()-14,GraphicsHeight()-40
EndIf

but it doesn't change the camera viewport in time for the picture.
why not?
What can i do to fix it?