Results 1 to 3 of 3

Thread: How to capture screen?

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 1999
    Location
    Prague, Czech Republic
    Posts
    350
    How can I simulate a PrintScrn key to save a picture of screen to a file?

  2. #2
    Fanatic Member
    Join Date
    Jan 2000
    Location
    Nitro
    Posts
    633
    Code:
    Option Explicit
    
    Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
    
    Private Sub Command1_Click()
     '1 is the screen. Replace it with 0 and you'll get the form
       keybd_event vbKeySnapshot, 1, 0&, 0&
    
       'update the clipboard before doing something else
       DoEvents
    
       'copy clipboard to the picturebox (vbCFBitmap = 2)
    
       Picture1 = Clipboard.GetData(vbCFBitmap)
       
       Clipboard.Clear
       Clipboard.SetData Picture1.Picture
    End Sub
    Chemically Formulated As:
    Dr. Nitro

  3. #3
    Fanatic Member
    Join Date
    Jan 2000
    Location
    Nitro
    Posts
    633
    Sorry! Use this line to save to a file. I only know how to save it as a BMP. If you want JPEG, search through this site and I think someone knows how to do it.

    Code:
      ' PURPOSE: Save the clipboard picture
      SavePicture Clipboard.GetData(vbCFBitmap), "C:\Test.bmp"
    Chemically Formulated As:
    Dr. Nitro

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