|
-
Mar 9th, 2002, 04:29 PM
#1
Thread Starter
Frenzied Member
Grabing The Desktop And Putting It In A Picture Box
hello people i want to grab the screen and put it in a picture box how can i do this? if found some things but they dont work
i want it to be captured on a button click name of the button GRAB and picturebox = picturegrab
this is on of the files i found
code:--------------------------------------------------------------------------------
Declare Function BitBlt Lib "gdi32" _
(ByVal hDestDC As Integer, ByVal x As Integer, _
ByVal y As Integer, ByVal nWidth As Integer, _
ByVal nHeight As Integer, ByVal _
hSrcDC As Integer, ByVal xSrc As Integer, _
ByVal ySrc As Integer, ByVal dwRop As _
Long) As Integer
Declare Function GetDesktopWindow Lib "user32" () As Long
Declare Function GetDC Lib "user32" _
(ByVal hwnd As Long) As Long
Sub Grabscreen(Dest As PictureBox)
Dim DeskhWnd As Long, DeskDC As Long
'Get the hWnd of the desktop
DeskhWnd = GetDesktopWindow()
'BitBlt needs the DC to copy the image. So, we
'need the GetDC API.
DeskDC = GetDC(DeskhWnd)
Dest.AutoRedraw = True
BitBlt Dest.hDC, 0, 0, _
Screen.Width / Screen.TwipsPerPixelX, Screen.Height / Screen.TwipsPerPixelY, DeskDC, _
0, 0, vbSrcCopy
Dest.Refresh
End Sub
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
|