PDA

Click to See Complete Forum and Search --> : Screenshots


Firejack
Feb 5th, 2002, 04:54 AM
:( - Right, I've given up on trying to work this out myself, so I'm going to post this all over the place and try to get some feedback off you guys...

THE PROGRAM:
Its a 3D game engine thingy. I wrote it in VB6 with my mate and then we converted it to C++. Its very nice, but has to be in C++ when you start using HUGE terrains like what we are.

THE PROBLEM:
I need to be able to take screenshots and I can't. I'm guessing that games do it by blitting the game window to an area of memory and then saving it or something?

I can't just use Print Screen cos my DirectInput is in foreground (or background... well, the one that stops Print Screen anyway).
:confused:
All answers in Vis Basic or C++, I really don't mind, just so long as it works!

Thanks!

FJ

And yes, I have posted this message in tons of places. Not sure if its supposed to be in C++, VB, Games and Graphics or the API section. Maybe we should start a thread to discuss this (or maybe not).

Hack
Feb 6th, 2002, 12:01 PM
This will save the screen as a bitmap. Hope this helps.Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, _
ByVal dwFlags As Long, ByVal dwExtraInfo As Long)

Private Const VK_SNAPSHOT = &H2C

Private Function SaveScreen(ByVal theFile As String) As Boolean
On Error Resume Next

'To get the Entire Screen
Call keybd_event(vbKeySnapshot, 1, 0, 0)

'To get the Active Window
'Call keybd_event(vbKeySnapshot, 0, 0, 0)

SavePicture Clipboard.GetData(vbCFBitmap), theFile

SaveScreen = True
Exit Function
End Function
'Usage
Call SaveScreen("C:\Windows\Desktop\shot1.bmp")