Results 1 to 24 of 24

Thread: Screen shot ![Resolved]

  1. #1

    Thread Starter
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083

    Screen shot ![Resolved]

    How can I take a screen shot in VB.NET?
    Last edited by Pirate; Feb 14th, 2003 at 12:37 PM.

  2. #2
    Hyperactive Member phrozeman's Avatar
    Join Date
    Apr 2000
    Location
    Netherlands
    Posts
    442
    PRINTSCREEN
    There's a certain mystique when I speak, that you notice that it's sorta unique, cause you know it's me

  3. #3
    Hyperactive Member phrozeman's Avatar
    Join Date
    Apr 2000
    Location
    Netherlands
    Posts
    442
    VB Code:
    1. Public Function GetScreenCapture( _
    2.    Optional ByVal FullScreen As Boolean = False) As Image
    3.    ' Captures the current screen and returns as an Image
    4.    ' object
    5.    Dim objSK As SendKeys
    6.    Dim imgCapture As Image
    7.    If FullScreen = True Then
    8.        ' Print Screen pressed twice here as some systems
    9.        ' grab active window "accidentally" on first run
    10.        objSK.SendWait("{PRTSC 2}")
    11.    Else
    12.        objSK.SendWait("%{PRTSC}")
    13.    End If
    14.    Dim objData As IDataObject = Clipboard.GetDataObject()
    15.    Return objData.GetData(DataFormats.Bitmap)
    16. End Function
    17.  
    18. 'USAGE
    19. GetScreenCapture(True).Save("c:\screengrab.bmp")
    20. PictureBox1.Image = GetScreenCapture()
    There's a certain mystique when I speak, that you notice that it's sorta unique, cause you know it's me

  4. #4

    Thread Starter
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    What does this symbol mean (%) ???

  5. #5

    Thread Starter
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    It did it !
    thanx for your help

  6. #6
    Hyperactive Member RealNickyDude's Avatar
    Join Date
    Nov 2002
    Location
    Watching you through the hidden camera :o
    Posts
    435

    Re: Screen shot !

    Originally posted by Pirate
    How can I take a screen shot in VB.NET?
    ... or use SnagIt!
    [vbcode]
    On Error GoTo Hell
    [/vbcode]:¬) Nicky : Why not try VBCodebook.NET.

  7. #7

    Thread Starter
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    no I just need to include this feature into my proj!

  8. #8
    Hyperactive Member phrozeman's Avatar
    Join Date
    Apr 2000
    Location
    Netherlands
    Posts
    442
    Originally posted by Pirate
    What does this symbol mean (%) ???
    That's used to make an screenshot from the current window... it's the same when u press ALT+PRINTSCREEN
    There's a certain mystique when I speak, that you notice that it's sorta unique, cause you know it's me

  9. #9

    Thread Starter
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    As I got this , it's like a shortcut key .If so , that would be great because I wanted to create a shortcut key !

  10. #10
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    umm any better way besides pressing the print key?
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  11. #11

    Thread Starter
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    shortcut keys !

  12. #12

    Thread Starter
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    I mean hotkeys

  13. #13
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    Originally posted by Pirate
    I mean hotkeys
    oh hotkeys
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  14. #14
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    what about them
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  15. #15

    Thread Starter
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Originally posted by MrPolite
    umm any better way besides pressing the print key?
    It's another way than Print key

  16. #16
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    Originally posted by Pirate
    It's another way than Print key
    eeh? my question was is there any way NOT to clear the clipboard by doing this? anyways this is not a proper way of getting a screenshot. I guess there's a way using APIs, I can't remember
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  17. #17
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    Originally posted by phrozeman
    That's used to make an screenshot from the current window... it's the same when u press ALT+PRINTSCREEN
    is there any ENUM that has all the values of the keys? it feels a little awkward this way
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  18. #18

    Thread Starter
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    I just like this way .Very easy to use .I got very complicated API code but it's very very complicated .

  19. #19
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    Originally posted by Pirate
    I just like this way .Very easy to use .I got very complicated API code but it's very very complicated .
    err it's ok, post it
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  20. #20

    Thread Starter
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    sorry I can't now .....lol

  21. #21
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    Originally posted by MrPolite
    eeh? my question was is there any way NOT to clear the clipboard by doing this? anyways this is not a proper way of getting a screenshot. I guess there's a way using APIs, I can't remember
    Sure, you save the clipboard contents to a variable first, then get the screenshot, then bring it into another bitmap variable. Now just restore the old content back to the clipboard, it happens so quick that it is like it never happened.

  22. #22

    Thread Starter
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Originally posted by hellswraith
    Sure, you save the clipboard contents to a variable first, then get the screenshot, then bring it into another bitmap variable. Now just restore the old content back to the clipboard, it happens so quick that it is like it never happened.
    Storing it to Clipboard , makes some delay .I will try your way now .

  23. #23

    Thread Starter
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    hellswraith , How can I save the screen shot directly to bitmap ??Is this possible ?

  24. #24
    Frenzied Member EyeTalion's Avatar
    Join Date
    Jul 2000
    Location
    New York
    Posts
    1,075
    this saves the image to my clipboard...how do I print?

    Code:
    Public Function GetScreenCapture( _
       Optional ByVal FullScreen As Boolean = False) As Image
       ' Captures the current screen and returns as an Image
       ' object
       Dim objSK As SendKeys
       Dim imgCapture As Image
       If FullScreen = True Then
           ' Print Screen pressed twice here as some systems
           ' grab active window "accidentally" on first run
           objSK.SendWait("{PRTSC 2}")
       Else
           objSK.SendWait("%{PRTSC}")
       End If
       Dim objData As IDataObject = Clipboard.GetDataObject()
       Return objData.GetData(DataFormats.Bitmap)
    End Function

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width