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.
Printable View
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.
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.
ØØ
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
If you are doing it that way you have to send the alt key at the same time.
ØØ
which way is easyer and how do i do it then?
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
ok where do i post that into my code and what should i declare those variables u added to the code as?
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
works just how i wanted.
thanks alot
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.
ØØ
This will capture the screen or a form.
(It is set to 800x600 for the screen capture)
Enjoy it! :wave: