Results 1 to 2 of 2

Thread: print screen

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2001
    Posts
    7
    hello
    how can I load the picture that is seen on the screen
    to a picture.
    i can't find the API that preforms that.
    thnx

  2. #2
    PowerPoster Chris's Avatar
    Join Date
    Jan 1999
    Location
    K-PAX
    Posts
    3,238
    nir_h20, try the following sample code.

    Code:
    Option Explicit
    Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
    
    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 KEYEVENTF_KEYUP = &H2
    Private Const VK_SNAPSHOT = &H2C
    Private Const VK_MENU = &H12
    
    Private Sub Command1_Click()
        'Capture the Entire Screen
        keybd_event VK_SNAPSHOT, 1, 0, 0
        
        'Save the capture image
        Save2File
    End Sub
    
    Private Sub Command2_Click()
        'Capture the Active Window
        keybd_event VK_MENU, 0, 0, 0
        keybd_event VK_SNAPSHOT, 0, 0, 0
        keybd_event VK_SNAPSHOT, 0, KEYEVENTF_KEYUP, 0
        keybd_event VK_MENU, 0, KEYEVENTF_KEYUP, 0
    
        'Save the capture image
        Save2File
    End Sub
    
    Private Sub Save2File()
        'Delay 3 seconds
        Sleep 3000
        
        'Load Image into the PictureBox
        Picture1.Picture = Clipboard.GetData()
    
        'Delay 3 second to complete load the image into the PictureBox Control
        Sleep 3000
        
        'Save new image file
        SavePicture Picture1, App.Path & "\MyPics.bmp"
    End Sub
    Cheers!

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