
Originally Posted by
si_the_geek
...you can use API's to get their screen location, such as
GetWindowRect...
Thanks for the advice, here's what I've done:
Code:
'Capture whole screen
Ret = GetDC(GetDesktopWindow)
'Get picturebox coordinates relative to the screen
rec = GetPictureBoxCoordinates(picSrc)
BitBlt picDest.hdc, 0, 0, rec.Right - rec.Left, rec.Bottom - rec.Top, Ret, rec.Left, rec.Top, SRCCOPY
'...
'In a module:
Public Function GetPictureBoxCoordinates(pic As PictureBox) As RECT
Dim Rec As RECT
GetWindowRect pic.hwnd, Rec
GetPictureBoxCoordinates = Rec
End Function
I'm almost done. Only, the left and top coordinates should be one pixel less, for the captured image misses the first row and column. Any reason for that?