Results 1 to 2 of 2

Thread: Screenshots

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Nov 2001
    Location
    Yorkshire, UK
    Posts
    21

    Exclamation Screenshots

    - 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).

    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).
    100% of drink driving incidents are alcohol related.

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    This will save the screen as a bitmap. Hope this helps.
    VB Code:
    1. Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, _
    2. ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
    3.  
    4. Private Const VK_SNAPSHOT = &H2C
    5.  
    6. Private Function SaveScreen(ByVal theFile As String) As Boolean
    7. On Error Resume Next
    8.  
    9. 'To get the Entire Screen
    10. Call keybd_event(vbKeySnapshot, 1, 0, 0)
    11.  
    12. 'To get the Active Window
    13. 'Call keybd_event(vbKeySnapshot, 0, 0, 0)
    14.  
    15. SavePicture Clipboard.GetData(vbCFBitmap), theFile
    16.  
    17. SaveScreen = True
    18. Exit Function
    19. End Function
    20. 'Usage
    21. Call SaveScreen("C:\Windows\Desktop\shot1.bmp")

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width