Screen Recorder in .NET 3.0

Discussion in 'Archives' started by Flaming Idiots, Mar 4, 2007.

Thread Status:
Not open for further replies.
Screen Recorder in .NET 3.0
  1. Unread #1 - Mar 4, 2007 at 10:17 AM
  2. Flaming Idiots
    Joined:
    Dec 22, 2005
    Posts:
    235
    Referrals:
    1
    Sythe Gold:
    0
    Two Factor Authentication User

    Flaming Idiots Active Member
    Visual Basic Programmers

    Screen Recorder in .NET 3.0

    Requirements:
    • .NET 3.0 installed on the computer using this.
    • WPF Extensions for VS 2005
    • Visual Studio 2005. Not VB Express edition.
    What you need to do:
    1. Create a new "Windows Application (WPF)"
      View attachment 783
    2. Add a reference to System.Drawing.dll, and System.Windows.Forms.dll
    3. Add the following code:
    Code:
    Public Class ScreenRecorder
    
        Private Shared tempDir As String = My.Computer.FileSystem.SpecialDirectories.Temp & "\snapshot\"
        Private Shared snap As New System.Threading.Thread(AddressOf Snapshot)
        Private Shared _Bounds As System.Drawing.Rectangle = System.Windows.Forms.Screen.PrimaryScreen.Bounds
        Public Shared Property Bounds() As System.Drawing.Rectangle
            Get
                Return _Bounds
            End Get
            Set(ByVal value As System.Drawing.Rectangle)
                _Bounds = value
            End Set
        End Property
        Private Shared Sub Snapshot()
            If Not My.Computer.FileSystem.DirectoryExists(tempDir) Then _
                My.Computer.FileSystem.CreateDirectory(tempDir)
            Dim Co As Integer = 0
            Do
                Co += 1
                System.Threading.Thread.Sleep(50)
                Dim X As New System.Drawing.Bitmap(_Bounds.Width, _Bounds.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb)
                Using G = System.Drawing.Graphics.FromImage(X)
                    G.CopyFromScreen(_Bounds.Location, New System.Drawing.Point(), _Bounds.Size)
                    Dim CurBounds As New System.Drawing.Rectangle(System.Windows.Forms.Cursor.Position - Bounds.Location, System.Windows.Forms.Cursor.Current.Size)
                    Forms.Cursors.Default.Draw(G, CurBounds)
                End Using
                Dim FS As New IO.FileStream(tempDir & FormatString(Co.ToString, 5, "0"c) & ".png", IO.FileMode.OpenOrCreate)
                X.Save(FS, System.Drawing.Imaging.ImageFormat.Png)
                X.Dispose()
                FS.Close()
            Loop
        End Sub
        Public Shared Sub ClearRecording()
            If My.Computer.FileSystem.DirectoryExists(tempDir) Then _
            My.Computer.FileSystem.DeleteDirectory(tempDir, FileIO.DeleteDirectoryOption.DeleteAllContents)
            My.Computer.FileSystem.CreateDirectory(tempDir)
        End Sub
        Public Shared Sub Save(ByVal Output As String)
            Dim G As New Windows.Media.Imaging.GifBitmapEncoder
    
            Dim X As New List(Of IO.FileStream)
            For Each Fi As String In My.Computer.FileSystem.GetFiles(tempDir, FileIO.SearchOption.SearchTopLevelOnly, "*.png")
                Dim TempStream As New IO.FileStream(Fi, IO.FileMode.Open)
                Dim Frame = Imaging.BitmapFrame.Create(TempStream)
                X.Add(TempStream)
                G.Frames.Add(Frame)
            Next
            Dim FS As New IO.FileStream(Output, IO.FileMode.OpenOrCreate)
            G.Save(FS)
            FS.Close()
    
            For Each St As IO.FileStream In X
                St.Close()
    
            Next
    
        End Sub
        Public Shared Sub Start()
            snap = New System.Threading.Thread(AddressOf Snapshot)
            snap.Start()
        End Sub
        Public Shared Sub [Stop]()
            snap.Abort()
        End Sub
        Private Shared Function FormatString(ByVal S As String, ByVal places As Integer, ByVal character As Char) As String
            If S.Length >= places Then Return S
            For X As Integer = S.Length To places
                S = character & S
            Next
            Return S
        End Function
    
    End Class
    To use the code:
    Starting:
    Code:
    ScreenRecorder.Start
    Stopping:
    Code:
    ScreenRecorder.Stop
    Saving:
    Code:
    ScreenRecorder.Save("")
    Setting the recording boundries:
    Code:
    ScreenRecorder.Bounds = New System.Drawing.Rectangle(300, 300, 500, 300)
    Erasing the recording:
    Code:
    ScreenRecorder.ClearRecording()
    Results:
    [​IMG]
     
  3. Unread #2 - Mar 4, 2007 at 4:15 PM
  4. X Zero
    Joined:
    Jan 21, 2007
    Posts:
    577
    Referrals:
    0
    Sythe Gold:
    0

    X Zero Forum Addict

    Screen Recorder in .NET 3.0

    WOW , thats uber great
     
  5. Unread #3 - Mar 4, 2007 at 10:20 PM
  6. cooladrrang
    Joined:
    Jan 21, 2007
    Posts:
    125
    Referrals:
    0
    Sythe Gold:
    0

    cooladrrang Active Member

    Screen Recorder in .NET 3.0

    hey can u do a a mini tut on how to use some stuff of that because i really dont get it ic lick two times on a button but the thing to do the codding doesnt appear what do i do
     
  7. Unread #4 - Mar 4, 2007 at 10:53 PM
  8. Swan
    Joined:
    Jan 23, 2007
    Posts:
    4,957
    Referrals:
    0
    Sythe Gold:
    0
    Sythe's 10th Anniversary Member of the Month Winner

    Swan When They Cry...
    Retired Global Moderator

    Screen Recorder in .NET 3.0

    did you put it in a class module?
     
  9. Unread #5 - Mar 9, 2007 at 12:38 PM
  10. ray230
    Referrals:
    0

    ray230 Guest

    Screen Recorder in .NET 3.0

    You cant even do things visualy in .NET 3.0.

    +


    There are two errors:

    1.Line 26 : Says something about using "as clause" or something



    2.Line 48: Says something about using "as clause" or something
     
  11. Unread #6 - Mar 9, 2007 at 6:32 PM
  12. slashshot007
    Joined:
    May 6, 2006
    Posts:
    164
    Referrals:
    0
    Sythe Gold:
    0

    slashshot007 Active Member

    Screen Recorder in .NET 3.0

    lyk omg this requires .net v3! lol i'll install it and try it out :p. you're the first one in the rs world to make a screenrecorder in vb.net if it works.
     
  13. Unread #7 - Mar 9, 2007 at 6:58 PM
  14. Skeletron
    Referrals:
    0

    Skeletron Guest

    Screen Recorder in .NET 3.0

    ray230, you need the .net 3.0 JDK.
    Not the package that enables you to use .net 3.0 applications.
    Also, the .net 3.0 JDK is only available for 64 bit machines.
     
  15. Unread #8 - Mar 9, 2007 at 7:59 PM
  16. cooladrrang
    Joined:
    Jan 21, 2007
    Posts:
    125
    Referrals:
    0
    Sythe Gold:
    0

    cooladrrang Active Member

    Screen Recorder in .NET 3.0

    um no im running 32-bit and i have .net 3 and vista is in 32-bit and 64-bit and it has .net 3(i know because i have vista 32-biT)
     
  17. Unread #9 - Mar 9, 2007 at 8:54 PM
  18. slashshot007
    Joined:
    May 6, 2006
    Posts:
    164
    Referrals:
    0
    Sythe Gold:
    0

    slashshot007 Active Member

    Screen Recorder in .NET 3.0

    is it .net 3.0 jdk? or just the regulare .net
     
  19. Unread #10 - Mar 9, 2007 at 9:03 PM
  20. ray230
    Referrals:
    0

    ray230 Guest

    Screen Recorder in .NET 3.0


    What is .NET 3.0 "JDK" you speak of. And where can I get it?
     
  21. Unread #11 - Mar 9, 2007 at 9:37 PM
  22. X Zero
    Joined:
    Jan 21, 2007
    Posts:
    577
    Referrals:
    0
    Sythe Gold:
    0

    X Zero Forum Addict

    Screen Recorder in .NET 3.0

    Ray next time do not spam another thread just to make people come to this one, we don't want u to get banned ,we need all the vb 2005 coders we can get

    Here is .net 3.0 donno if its the right one but everything u will need for vb 2005 is on Microsoft.com
     
  23. Unread #12 - Mar 9, 2007 at 9:59 PM
  24. Puzzle
    Joined:
    May 6, 2005
    Posts:
    846
    Referrals:
    0
    Sythe Gold:
    0

    Puzzle Apprentice

    Screen Recorder in .NET 3.0

    wow this is some awesome code
     
  25. Unread #13 - Mar 9, 2007 at 11:01 PM
  26. ray230
    Referrals:
    0

    ray230 Guest

    Screen Recorder in .NET 3.0

    I already have the .NET 3.0.
     
  27. Unread #14 - Mar 10, 2007 at 1:10 AM
  28. ray230
    Referrals:
    0

    ray230 Guest

    Screen Recorder in .NET 3.0

    Variable Declaration without an 'As' clause; type of object assumed.


    ^^^^^

    That's what it says on Frame , and G. The two letters underlined green.


    Help please.


    EDIT: And how do you make buttons?
     
  29. Unread #15 - Mar 10, 2007 at 1:44 AM
  30. X Zero
    Joined:
    Jan 21, 2007
    Posts:
    577
    Referrals:
    0
    Sythe Gold:
    0

    X Zero Forum Addict

    Screen Recorder in .NET 3.0

    theres a toolbox on the side click "button" and make one on the form
     
  31. Unread #16 - Mar 10, 2007 at 2:03 AM
  32. ray230
    Referrals:
    0

    ray230 Guest

    Screen Recorder in .NET 3.0




    In .NET 3.0 you cannot do that, All there is is an XML file and a form code. You cannot do anything visually in .NET 3.0



    EDIT: Please answer my above reply.
     
  33. Unread #17 - Mar 10, 2007 at 3:21 AM
  34. Swan
    Joined:
    Jan 23, 2007
    Posts:
    4,957
    Referrals:
    0
    Sythe Gold:
    0
    Sythe's 10th Anniversary Member of the Month Winner

    Swan When They Cry...
    Retired Global Moderator

    Screen Recorder in .NET 3.0

    What do you mean? I can code it through the VB 2005 IDE. Visual as Visual can be.
     
  35. Unread #18 - Mar 10, 2007 at 1:10 PM
  36. Skeletron
    Referrals:
    0

    Skeletron Guest

    Screen Recorder in .NET 3.0

    When you download VB.net, it comes standard with a .net JDK.
     
  37. Unread #19 - Mar 10, 2007 at 1:50 PM
  38. ray230
    Referrals:
    0

    ray230 Guest

    Screen Recorder in .NET 3.0


    What is an IDE, and JDK?
     
  39. Unread #20 - Mar 11, 2007 at 5:38 AM
  40. X Zero
    Joined:
    Jan 21, 2007
    Posts:
    577
    Referrals:
    0
    Sythe Gold:
    0

    X Zero Forum Addict

    Screen Recorder in .NET 3.0

    Ok got it working but how do i save?

    What format?
    Tryed .wmv But didn't play neither .gif?

    help please X Zero
     
< CSS Camping | Did anything ever happen with the whole sigex issue? >

Users viewing this thread
1 guest
Thread Status:
Not open for further replies.


 
 
Adblock breaks this site