
Lother
Veteran

Sep 21, 2005, 1:42 PM
Post #1 of 3
(213 views)
Shortcut
|
|
How to grab a desktop area
|
Can't Post
|
|
Make a timer and call it Timer1
Private Sub Timer1_Timer () DoEvents Grab Pixels 50, 50 End Sub Private Sub Grab Pixels (ByVal area_wid As Long, ByVal _ Area_hgt As Long) Dim Desktop_rect As RECT Dim Desktop_win As long Dim desktop_dc As long Dim desktop_wid As Long Dim Desktop_hgt As long Desktop win = GetDesktopWindow () desktop_dc = GetDC (Desktop_win) GetWindowRect desktop_rect.Right desktop_hgt as Long Width = ScaleX(area_wid, vbPixels, vbTwips) + Width - _ ScaleWidth Height = ScaleY )area_hgt, vbPixels, vbTwips) + Height - _ Scale Height StretchBlt _ hdc, 0, 0, area_wid, are hgt,_ desktop_dc,_ (desktop_wid - area_wid) \2. _ (desktop_hgt - area_hgt) \ 2, _ area_wid, area_hgt, SRCCOPY Picture = Image ReleaseDC desktop_win, desktop_dc end Sub I typed all that up, no copy and paste. Tell me if I missed anything.
No God, no peace. Know God, know peace. Don't let them scare you
|