Results 1 to 6 of 6

Thread: Take Screen shot

  1. #1

    Thread Starter
    Addicted Member Diab's Avatar
    Join Date
    Apr 2001
    Posts
    185

    Take Screen shot

    How Can I Take Screen Shot Useing Api Function !
    like to press PrintScreen Button And Then Past To picture file !

  2. #2
    Addicted Member
    Join Date
    Feb 2001
    Location
    Upstate NY
    Posts
    210
    < o >

  3. #3
    Frenzied Member Vlatko's Avatar
    Join Date
    Aug 2000
    Location
    Skopje, Macedonia
    Posts
    1,409
    Something like this:

    Code:
    Dim handle as Long
    handle = GetDesktopWindow
    Dim dc as Long
    dc = GetDC(handle)
    
    'then use BitBlt to get the whole dc (whole screen).
    I am become death, the destroyer of worlds.
    mail:[email protected]

    • Visual Basic 6.0 & .NET
    • Visual C++ 6.0 & .NET
    • ASP
    • LISP
    • PROLOG
    • C
    • Pascal

  4. #4
    Member Stef's Avatar
    Join Date
    May 2001
    Posts
    41
    Is there any easy way to get that image into a direct 3d texture (directx8)? (Preferably not by saving the image to disk and then loading it with D3DX.CreateTextureFromFile)

  5. #5

    Thread Starter
    Addicted Member Diab's Avatar
    Join Date
    Apr 2001
    Posts
    185

    Unhappy Ok So

    i have do like this


    Dim handle as Long
    handle = GetDesktopWindow
    Dim dc as Long
    dc = GetDC(handle)

    'then use BitBlt to get the whole dc (whole screen).

    if i want to use the BitBlt but without PictureBox Or Image On My Form
    I Need To SAve The Picture In BinaryFile and after that to use it with
    another application !


  6. #6
    Member Stef's Avatar
    Join Date
    May 2001
    Posts
    41
    The following code sends a "printscreen button pressed"-event to the active window. Perhaps someone else could modify it (using sendmessage?) to send it to the desktop?

    Code:
    Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal _
     bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
    Const VK_SNAPSHOT As Byte = 44
    
    'and where you want to send the event place the following code
    keybd_event VK_SNAPSHOT, 0, 0, 0
    DoEvents 'to allow windows time to take the screenshot
    'And finally use clipboard.getdata to put it in 
    'a picturebox or something...
    When I put this in the form_load sub i got a nice screenshot of the VB window. Perhaps a compiled version will get one of the desktop (haven't tried that yet).

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