none
how to capture full screen in vb.net or c# RRS feed

  • Question

  • hello freinds , i have made a screen tool which captures the image of monitor, made in vb.net... the tool works awesom but the problem occurs when this thing happens >>

    i have adjust a timer inside the tool , which make it to capture the screen at specific interval .

    I want to capture the screen of my maximized counter strike game or any game which is maximized to full screen 

    i set the timer , let say to 10 sec , after ten sec the tool will grab the screen , but when it capture the screen, i dont know what happen and some annoying half part gets captured which is very irritating , so where i am wrong , i am pasting the code in vb.net

     Dim graph As Graphics = Nothing
            Try
                Dim bmp As New Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height)
                graph = Graphics.FromImage(bmp)
                graph.CopyFromScreen(0, 0, 0, 0, bmp.Size)


                If Not Directory.Exists("C:\game screenshots") Then
                    Directory.CreateDirectory("C:\game screenshots")
                End If

                k = "C:\game screenshots\" + (Rnd() + 7).ToString + ".jpg"
                bmp.Save(k, System.Drawing.Imaging.ImageFormat.Jpeg)

                End try

    thanx regards 1001001010101

    Saturday, August 25, 2012 11:19 AM

Answers

  • plz tell me how, thanx
    On the Standard menu bar in your IDE, click Help.  Click View Help on the Help menu.  Click Index in the left pane of the Help Viewer.  Type Using in the textbox.  Clck on Using block.  In the right pane you should see the topic:  "How to: Dispose of a System Resource (Visual Basic)".  Under See Also, Reference, click on Using Statement (Visual Basic).  Read the topic to learn how to use the VB Using statement and follow the example to enclose your GDI+ objects in using blocks.

    • Edited by JohnWein Sunday, August 26, 2012 1:14 PM
    • Marked as answer by code cOMrade Tuesday, August 28, 2012 4:19 AM
    Sunday, August 26, 2012 1:13 PM

All replies

  • Dispose your GDI+ objects.  Enclose them in Using blocks.
    Saturday, August 25, 2012 1:52 PM
  • plz tell me how, thanx
    Sunday, August 26, 2012 11:08 AM
  • plz tell me how, thanx
    On the Standard menu bar in your IDE, click Help.  Click View Help on the Help menu.  Click Index in the left pane of the Help Viewer.  Type Using in the textbox.  Clck on Using block.  In the right pane you should see the topic:  "How to: Dispose of a System Resource (Visual Basic)".  Under See Also, Reference, click on Using Statement (Visual Basic).  Read the topic to learn how to use the VB Using statement and follow the example to enclose your GDI+ objects in using blocks.

    • Edited by JohnWein Sunday, August 26, 2012 1:14 PM
    • Marked as answer by code cOMrade Tuesday, August 28, 2012 4:19 AM
    Sunday, August 26, 2012 1:13 PM
  • thanx... :)
    Tuesday, August 28, 2012 4:19 AM