Question Screen Recorder Help

Giver

New member
Joined
Aug 9, 2008
Messages
2
Programming Experience
Beginner
Okay I'm not sure that this is in the right catagory, but I'm pretty sure it is. I want to make a Screen Recorder which takes a screenshot of the screen every time a timer ticks. Then I want to compress the image into an .avi file.
I have tried doing this in the following code, but I don't know why it doesn't work.

VB.NET:
Imports System.IO

Public Class Form1
    Dim Screen As New Bitmap(My.Computer.Screen.Bounds.Width, My.Computer.Screen.Bounds.Height)
    Dim Screensize As New Size(My.Computer.Screen.Bounds.Width, My.Computer.Screen.Bounds.Height)
    Dim G As Graphics = Graphics.FromImage(Screen)
    Dim Stream As New FileStream("C:\Documents and Settings\HP_Administrator\My Documents\Neal\Videos and Sounds\TestVideo.avi", FileMode.Append)

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnStart.Click
        TmrCapture.Start() 'Starts the Timer
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnStop.Click
        TmrCapture.Stop() 'Stops the Timer
    End Sub

    Private Sub TmrCapture_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TmrCapture.Tick
        G.CopyFromScreen(New Point, New Point, Screensize) 'Takes a screen shot of the screen
        Screen.Save(Stream, Imaging.ImageFormat.Bmp) 'saves the screen shot to the following stream
    End Sub
End Class
 
Top Bottom