Dim r As Long Dim hdc As Long hdc = GetDC(target.hwnd) Debug.Assert hdc <> 0 Dim hBitmap As Long hBitmap = CreateCompatibleBitmap(hdc, width, height) Debug.Assert hdc <> 0 Dim lpBI As BITMAPINFO lpBI.bmiHeader.biSize = Len(lpBI) lpBI.bmiHeader.biWidth = width lpBI.bmiHeader.biHeight = height lpBI.bmiHeader.biPlanes = 1 lpBI.bmiHeader.biBitCount = 32 lpBI.bmiHeader.biCompression = BI_RGB lpBI.bmiHeader.biSizeImage = width * height 'may be zero lpBI.bmiHeader.biXPelsPerMeter = 1000 lpBI.bmiHeader.biYPelsPerMeter = 1000 lpBI.bmiHeader.biClrUsed = 0 lpBI.bmiHeader.biClrImportant = 0 r = SetDIBits(hdc, hBitmap, 0, height, accum(0), lpBI, DIB_RGB_COLORS) Debug.Assert r <> 0 ReleaseDC target.hwnd, hdc