Mar 17th, 2005, 10:14 PM
#1
Thread Starter
Junior Member
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 .
Mar 17th, 2005, 10:16 PM
#2
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.
ØØ
Mar 17th, 2005, 10:21 PM
#3
Thread Starter
Junior Member
Re: screenshots
this is the code im using to take a screen shot
VB Code:
Private Sub screenshot_Click()
Dim ran As Long
Randomize
ran = Rnd * 999999
Round (ran)
keybd_event VK_SNAPSHOT, 1, 0, 0
DoEvents
picscreenshot.Picture = Clipboard.GetData
SavePicture picscreenshot.Picture, App.Path & "\Screenshots\Screen" & ran & ".bmp"
Clipboard.Clear
End Sub
Mar 17th, 2005, 10:29 PM
#4
Re: screenshots
If you are doing it that way you have to send the alt key at the same time.
ØØ
Mar 17th, 2005, 10:31 PM
#5
Thread Starter
Junior Member
Re: screenshots
which way is easyer and how do i do it then?
Mar 17th, 2005, 10:54 PM
#6
Re: screenshots
Something like this should do it:
VB Code:
keybd_event VK_MENU, 0, 0, 0
keybd_event VK_SNAPSHOT, 0, 0, 0
keybd_event VK_SNAPSHOT, 0, KEYEVENTF_KEYUP, 0
keybd_event VK_MENU, 0, KEYEVENTF_KEYUP, 0
Mar 17th, 2005, 11:01 PM
#7
Thread Starter
Junior Member
Re: screenshots
ok where do i post that into my code and what should i declare those variables u added to the code as?
Mar 17th, 2005, 11:04 PM
#8
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
Mar 17th, 2005, 11:08 PM
#9
Thread Starter
Junior Member
Re: screenshots
works just how i wanted.
thanks alot
Mar 17th, 2005, 11:12 PM
#10
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.
ØØ
Mar 18th, 2005, 12:40 AM
#11
Re: screenshots
This will capture the screen or a form.
(It is set to 800x600 for the screen capture)
Enjoy it!
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
Forum Rules
Click Here to Expand Forum to Full Width