Source Code AUTO CAPTURE screen in Visual Basic

This is example code on how to capture screen (Print Screen). This technique is often used on spy programs, which in addition to recording every keystroke also capture screen images.

An example of this code is very simple, so it's easy for you to understand and develop as your needed. Components needed  are:

- Timer.
Set Enable = True, and Interval = 1000

- Picturebox.
Set AutoRedraw = True

This program we set to capture the screen on thirtieth seconds. If you've never been and want to try it, please run your Visual Basic application and follow the steps below:

1. Create a New Project.
Add a Timer and a PictureBox (You can follow the example image below or on your own way).



2. Open the code window by pressing F7 key and copy the code below!
Private Declare Sub keybd_event Lib "user32.dll" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlages As Long, ByVal dwExtraInfo As Long)

Private Sub Form_Load()

End Sub

Private Sub Timer1_Timer()
  On Error Resume Next
     If Second(Now) = 30 Then
        keybd_event vbKeySnapshot, 0, 0&, 0&
        PaintPicture Picture1.Image, 0, 0, Picture1.Width, Picture1.Height
        Picture1.PaintPicture Clipboard.GetData(vbCFBitmap), 0, 0, Picture1.Width, Picture1.Height
   For i = 1 To Len(Now)
     If IsNumeric(Mid(Now, i, 1)) Then datagam = datagam & Mid(Now, i, 1)
   Next i
       SavePicture Clipboard.GetData(vbCFBitmap), App.Path & "\" & datagam & ".bmp"
  End If
End Sub


When the program runs, it will capture the screen image and will be saved in the folder location of the application.



This example runs on Windows 7.
You can hide this application from the PC screen and the Task Manager (see in the previous post).


Keyword: ScreenShot Code | Capture Screen Source Code | How to Capture Screen | Auto Capture Screen Example | Visual Basic Auto Capture Screen

You may also like: