|
-
Aug 6th, 2000, 07:48 AM
#1
Thread Starter
New Member
hi,
how can i make a screenshot NOT from the whole screen
or an application window? for example i wanna screenshot only a little window at:
point1 x=200,y=200;
point2 x=300,y=200;
point3 x=200,y=300;
point4 x=300,y=300.
Y
|
4 |
3 | . .
2 | . . <- screen to grab
1 |
|------------ X
1 2 3 4 5 ...
does somebody have a clue how i could handle this?
thank you
-broesel
-
Aug 6th, 2000, 07:58 AM
#2
Fanatic Member
An Idea would be to BitBlt it to a PictureBox, and then save the picture.
But I'm not really specialised on this area, so I'll leave it all to the more knowledgeable wombats *ahem* Gurus.
-
Aug 6th, 2000, 10:07 AM
#3
Try this.
Start a new standard EXE project and add a CommandButton to the form. Then add the following code:
Code:
Private Declare Function GetDesktopWindow _
Lib "user32" () As Long
Private Declare Function GetDC _
Lib "user32" ( _
ByVal hwnd As Long) As Long
Private Declare Function ReleaseDC _
Lib "user32" ( _
ByVal hwnd As Long, _
ByVal hdc As Long) As Long
Private Declare Function BitBlt Lib "gdi32" ( _
ByVal hDestDC As Long, _
ByVal x As Long, _
ByVal y As Long, _
ByVal nWidth As Long, _
ByVal nHeight As Long, _
ByVal hSrcDC As Long, _
ByVal xSrc As Long, _
ByVal ySrc As Long, _
ByVal dwRop As Long) As Long
Private Const SRCCOPY = &HCC0020
Private Sub Form_Load()
'You could set these properties at design time if you like
Me.ScaleMode = vbPixels
Me.AutoRedraw = True
End Sub
Private Sub Command1_Click()
Dim hDC&, hWnd&
hWnd = GetDesktopWindow
hDC = GetDC(hWnd)
BitBlt Me.hdc, 0&, 0&, 100&, 100&, hDC, 200&, 200&, SRCCOPY
Me.Refresh
ReleaseDC hWnd, hDC
End Sub
Good luck!
-
Aug 6th, 2000, 11:03 AM
#4
Thread Starter
New Member
thanks for your reply, its working!
broesel
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
|