|
-
Sep 26th, 2002, 12:51 PM
#1
Thread Starter
Addicted Member
Screencaptures
Hi everyone!
I want to make a screencapture of my program and put it in a picturebox. Is this possible in vb?
Thanks in advance,
Shell
-
Sep 26th, 2002, 12:52 PM
#2
Thread Starter
Addicted Member
btw, i want to do it with code offcourse
-
Sep 26th, 2002, 05:17 PM
#3
Fanatic Member
VB Code:
Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Private Sub Command1_Click()
keybd_event vbKeySnapshot, 1, 0&, 0&
End Sub
-
Sep 26th, 2002, 05:34 PM
#4
Addicted Member
Originally posted by Shell
btw, i want to do it with code offcourse
It is possible, but it requires the use of the API. Sadly, I don't have the code to do it here. A search at www.codehound.com should turn something up for ya.
-
Sep 26th, 2002, 05:34 PM
#5
Addicted Member
Originally posted by Mushroom Realm
VB Code:
Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Private Sub Command1_Click()
keybd_event vbKeySnapshot, 1, 0&, 0&
End Sub
That will copy it to the clipboard, not place it in a picturebox.
-
Sep 27th, 2002, 12:54 AM
#6
Thread Starter
Addicted Member
Thanks for the adress sheppe, its a good site 
Still looking for a way to do this 
Shell
-
Sep 27th, 2002, 06:36 AM
#7
Good Ol' Platypus
You do know about VB's clipboard object, do you not?
VB Code:
Picture1.Picture = Clipboard.GetData(2)
Picture1.Refresh
Unfortunately Mushroom's code seems to only capture the form.
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
-
Sep 27th, 2002, 07:28 AM
#8
Thread Starter
Addicted Member
Yes, i know how tu use the clipboard, but I dont want to use it now because my program allready uses it for some other data
-
Sep 27th, 2002, 09:53 AM
#9
Addicted Member
Originally posted by Sastraxi
You do know about VB's clipboard object, do you not?
VB Code:
Picture1.Picture = Clipboard.GetData(2)
Picture1.Refresh
Unfortunately Mushroom's code seems to only capture the form.
I know about it too; I just regard it as a shortcut hack. No offense intended.
-
Sep 27th, 2002, 09:57 AM
#10
Addicted Member
-
Sep 27th, 2002, 12:27 PM
#11
Thread Starter
Addicted Member
Ah!! Victory!!
I took a look at the program you posted, and made my own function, behold!! 
Code:
<script language="vbScript">
<!--
Public Function CaptureScreen(lHwnd as long,lDestDC as long,iScreenWidth as integer,iScreenHeight as integer)
Dim lhDc As Long
lhDc = GetDC(lHwnd )
BitBlt lDestDC , 0, 0, iScreenWidth , iScreenHeight , lhDc, 0, 0, SRCCOPY
//-->
</script>
Thanks all
-
Sep 27th, 2002, 12:27 PM
#12
Thread Starter
Addicted Member
lol, formatting messed up
-
Sep 27th, 2002, 02:50 PM
#13
Good Ol' Platypus
That's OK Sheppe, just remember, lots of times, the easiest way is sometimes the best.
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
-
Sep 30th, 2002, 11:06 AM
#14
Addicted Member
Originally posted by Sastraxi
That's OK Sheppe, just remember, lots of times, the easiest way is sometimes the best.
Sometimes, but not always. In this instance, blowing away the user's clipboard contents could be regarded as a problem. True, a simple backup of the contents would solve that, but then you have to wonder what he wants as far as functionality. Does he want to capture the whole form, or a region of the form. Perhaps he wants to capture the entire screen with the form as it is displayed. There are a lot of factors to consider, and with the prolific amount of code on the net, I would say that the easiest, and most efficient way in this case, would be to find a code example on how to do a proper screen capture, as was done.
-
Sep 30th, 2002, 03:01 PM
#15
Good Ol' Platypus
I was merely telling how to capture the clipboard as that's what he asked to do, I'm not condoning it
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
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
|