Results 1 to 2 of 2

Thread: Partial screen capture via xy and height/width parameters

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2004
    Posts
    2

    Partial screen capture via xy and height/width parameters

    VB gurus please help:

    I want to capture an area of the screen providing the routine xy coordinates and the height and width of the screen area. This capture would be at intervals and once captured comparing the image area captured to a database of .bmp files (small images of approximately 500 bytes preloaded to an array) of same area for comparison to determine if changed.

    To get a start on this first of all I would like input as to the use of VB6 or .NET for this endeaver. Secondly, any recommendations as to where I could find routines that would closely resemble this capability.

    As always I appreicate any input provided.

    Fred Hanna
    Last edited by Electroman; Nov 9th, 2004 at 06:52 AM.

  2. #2
    Ex-Super Mod'rater Electroman's Avatar
    Join Date
    Sep 2000
    Location
    Newcastle, England
    Posts
    4,349
    You can use the GetDesktopWindow() and GetWindowDC() APIs to BitBlt a portion of the Desktop .

    VB Code:
    1. Public Declare Function GetDesktopWindow Lib "user32" Alias "GetDesktopWindow" () As Long
    2. Public Declare Function GetWindowDC Lib "user32" Alias "GetWindowDC" (ByVal hwnd As Long) As Long
    3. Public Declare Function BitBlt Lib "gdi32" Alias "BitBlt" (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
    4.  
    5. Dim DesktopDC as Long
    6.  
    7.     DesktopDC = GetWindowDC(GetDesktopWindow())
    8.  
    9.     BitBlt picDest.hDC, 0, 0, Width, Height, DesktopDC, X, Y, vbSrcCopy
    When your thread has been resolved please edit the original post in the thread ()
    and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.

    When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width