Results 1 to 3 of 3

Thread: get print screen image

  1. #1

    Thread Starter
    Hyperactive Member demon.KILER's Avatar
    Join Date
    Jul 2006
    Location
    I cannot remember !?
    Posts
    408

    Question get print screen image

    hi everybody

    I want to view the print scrn image in my picture box So i need to get the image from the clipboard

    this is what I did until now

    VB Code:
    1. Dim clipdata As IDataObject
    2.  Dim myimg As Image
    3. Windows.Forms.SendKeys.SendWait("{PRTSC}")
    4. clipdata = Clipboard.GetDataObject()
    5.         If clipdata.GetDataPresent(GetType(System.Drawing.Bitmap)) Then
    6.            myimg = CType(clipdata.GetData(GetType(System.Drawing.Bitmap)), Image)
    7.         End If

    this code doesn't work

    thx for future help
    VS 2005 .....Framework SDK 3.0

    "Its mostly the brave one who choose to not fight"

  2. #2
    PowerPoster VBDT's Avatar
    Join Date
    Sep 2005
    Location
    CA - USA
    Posts
    2,922

    Re: get print screen image

    SendKeys are not reliable so I wont recommend you to use them at all. There are other (better) ways to get the screen image! This one will copy the screen in to a bitmap and then save it on to the desktop as a .png file. Note that this will not capture a transparent image. To get a transparent images from the screen you can download the "Screen Shot" app in my signature or take a look the source files to see how it is done (check the new version).
    VB Code:
    1. Dim img As New Bitmap(My.Computer.Screen.Bounds.Width, My.Computer.Screen.Bounds.Height)
    2.         Dim g As Graphics
    3.         g = Graphics.FromImage(img)
    4.         g.CopyFromScreen(0, 0, 0, 0, img.Size)
    5.         img.Save(My.Computer.FileSystem.SpecialDirectories.Desktop & "\gg.png", System.Drawing.Imaging.ImageFormat.Png)
    6.         g.Dispose()

  3. #3

    Thread Starter
    Hyperactive Member demon.KILER's Avatar
    Join Date
    Jul 2006
    Location
    I cannot remember !?
    Posts
    408

    Re: get print screen image

    VBDT I will try that thx

    My send key works I tested it
    VS 2005 .....Framework SDK 3.0

    "Its mostly the brave one who choose to not fight"

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