Results 1 to 11 of 11

Thread: resolved -- screenshots -- resolved

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Mar 2005
    Posts
    20

    Resolved resolved -- screenshots -- resolved

    how can i take a screen shot of just the things in the form in vb, i can get it to do a print sceen of the form and take a screen shot of everything in my desktop but no of just the form.
    Last edited by Stealth955; Mar 18th, 2005 at 12:54 AM.

  2. #2
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190

    Re: screenshots

    Do you use BitBlt to take that screen shot? If so, in the X Y parameters of BitBlt, send in the coordinates of the form, and the width and height too.



    ØØ

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Mar 2005
    Posts
    20

    Re: screenshots

    this is the code im using to take a screen shot

    VB Code:
    1. Private Sub screenshot_Click()
    2.     Dim ran As Long
    3.     Randomize
    4.     ran = Rnd * 999999
    5.     Round (ran)
    6.     keybd_event VK_SNAPSHOT, 1, 0, 0
    7.     DoEvents
    8.  
    9.     picscreenshot.Picture = Clipboard.GetData
    10.  
    11.  
    12.     SavePicture picscreenshot.Picture, App.Path & "\Screenshots\Screen" & ran & ".bmp"
    13.     Clipboard.Clear
    14.  
    15. End Sub

  4. #4
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190

    Re: screenshots

    If you are doing it that way you have to send the alt key at the same time.



    ØØ

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Mar 2005
    Posts
    20

    Re: screenshots

    which way is easyer and how do i do it then?

  6. #6
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190

    Re: screenshots

    Something like this should do it:



    VB Code:
    1. keybd_event VK_MENU, 0, 0, 0
    2. keybd_event VK_SNAPSHOT, 0, 0, 0
    3. keybd_event VK_SNAPSHOT, 0, KEYEVENTF_KEYUP, 0
    4. keybd_event VK_MENU, 0, KEYEVENTF_KEYUP, 0

  7. #7

    Thread Starter
    Junior Member
    Join Date
    Mar 2005
    Posts
    20

    Re: screenshots

    ok where do i post that into my code and what should i declare those variables u added to the code as?

  8. #8
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190

    Re: screenshots

    Add it in stead of your line that was:

    keybd_event VK_SNAPSHOT, 1, 0, 0



    And then add this to the top of your app under Option Explicit:

    Private Const KEYEVENTF_KEYUP = &H2
    Private Const VK_SNAPSHOT = &H2C
    Private Const VK_MENU = &H12

  9. #9

    Thread Starter
    Junior Member
    Join Date
    Mar 2005
    Posts
    20

    Re: screenshots

    works just how i wanted.
    thanks alot

  10. #10
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190

    Re: screenshots

    No problem, just happy to help. Just remember to edit the first post, and add the green check mark to it (the icon) so everyone can see it is resolved.




    ØØ

  11. #11
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: screenshots

    This will capture the screen or a form.
    (It is set to 800x600 for the screen capture)

    Enjoy it!
    Attached Files Attached Files

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