I used this code to capture the entire screen and to write the bitmap into an array:
VB Code:
Dim bBytes(1 To 2359296) As Byte Dim hdc0 As Long Dim idc As Long Dim ibitmap As Long With bi24BitInfo.bmiHeader .biBitCount = 24 .biCompression = BI_RGB .biPlanes = 1 .biSize = Len(bi24BitInfo.bmiHeader) .biWidth = 1024 .biHeight = 768 End With hdc0 = GetDC(0) idc = CreateCompatibleDC(0) ibitmap = CreateDIBSection(idc, bi24BitInfo, DIB_RGB_COLORS, ByVal 0&, ByVal 0&, ByVal 0&) SelectObject idc, ibitmap BitBlt idc, 0, 0, bi24BitInfo.bmiHeader.biWidth, bi24BitInfo.bmiHeader.biHeight, hdc0, 0, 0, vbSrcCopy GetDIBits hdc0, ibitmap, 0, bi24BitInfo.bmiHeader.biHeight, bBytes(1), bi24BitInfo, DIB_RGB_COLORS
it took ~ 500 ms to perform this code as compiled application.
i found out that the line with the bitblt call takes ~ 460ms.
but why so long? this command only copies 2,3 MB from one memory block to the other.... that cant take 500 ms...
how can I optimate this line of code?
thanks for any help


Reply With Quote