I used this code to capture the entire screen and to write the bitmap into an array:

VB Code:
  1. Dim bBytes(1 To 2359296) As Byte
  2.     Dim hdc0 As Long
  3.     Dim idc As Long
  4.     Dim ibitmap As Long
  5.    
  6.     With bi24BitInfo.bmiHeader
  7.         .biBitCount = 24
  8.         .biCompression = BI_RGB
  9.         .biPlanes = 1
  10.         .biSize = Len(bi24BitInfo.bmiHeader)
  11.         .biWidth = 1024
  12.         .biHeight = 768
  13.     End With
  14.  
  15.     hdc0 = GetDC(0)
  16.     idc = CreateCompatibleDC(0)
  17.  
  18.     ibitmap = CreateDIBSection(idc, bi24BitInfo, DIB_RGB_COLORS, ByVal 0&, ByVal 0&, ByVal 0&)
  19.    
  20.     SelectObject idc, ibitmap
  21.     BitBlt idc, 0, 0, bi24BitInfo.bmiHeader.biWidth, bi24BitInfo.bmiHeader.biHeight, hdc0, 0, 0, vbSrcCopy
  22.     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