Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public Class Form1
- Dim bmpScreenCapture = New Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height)
- Dim DelayNextScreen = Environment.TickCount
- Dim g As Graphics = Graphics.FromImage(bmpScreenCapture)
- Dim CapturerThread As New System.Threading.Thread(AddressOf Capturer)
- Dim ShowImage As Bitmap
- Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
- CapturerThread.IsBackground = True
- CapturerThread.Start()
- End Sub
- Delegate Sub UpdateImage()
- Sub UpdateImageGUI()
- PictureBox1.Image = ShowImage
- End Sub
- Dim s As New UpdateImage(AddressOf UpdateImageGUI)
- Sub Capturer()
- Do
- g.CopyFromScreen(Screen.PrimaryScreen.Bounds.X, Screen.PrimaryScreen.Bounds.Y, 0, 0, bmpScreenCapture.Size, CopyPixelOperation.SourceCopy)
- Dim nf As Bitmap = bmpScreenCapture.Clone()
- Dim t As New System.Timers.Timer
- t.Interval = 5000
- t.AutoReset = False
- ShowImage = nf.Clone()
- AddHandler t.Elapsed, (Sub()
- ShowImage = nf.Clone()
- nf.Dispose()
- nf = Nothing
- System.GC.Collect()
- System.GC.WaitForPendingFinalizers()
- Try
- Invoke(s)
- Catch ex As Exception
- End Try
- End Sub)
- t.Start()
- System.Threading.Thread.Sleep(50) 'Framerate: 20 fps
- Loop
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement