bmiColors As RGBQUAD ' RGB, so length here doesn't matter
End Type
Dim binfo As BITMAPINFO
Dim CompDC As Long ' Compatible DC to hold the bitmap
Dim addr As Long ' Pointer to memory block containing bitmap data
Dim DIBSectionHandle As Long ' Handle to DIBSection
Dim OldCompDCBM As Long ' Original bitmap for CompDC
Dim BytesPerScanLine As Long ' Hold this value to improve performance
Private Const BI_RGB = 0&
Private Const BI_RLE8 = 1&
Private Const BI_RLE4 = 2&
Private Const DIB_RGB_COLORS = 0 ' color table in RGBs
Private Const DIB_PAL_COLORS = 1 ' color table in palette indices
Private Const SRCCOPY = &HCC0020 ' (DWORD) dest = source
Private Declare Function CreateDIBSection Lib "gdi32" (ByVal hdc As Long, pBitmapInfo As BITMAPINFO, ByVal un As Long, lplpVoid As Long, ByVal handle As Long, ByVal dw As Long) As Long
Private Declare Function CreateCompatibleDC Lib "gdi32" (ByVal hdc As Long) As Long
Private Declare Function BitBlt Lib "gdi32" (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
Private Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, ByVal hObject As Long) As Long
Private Declare Function DeleteDC Lib "gdi32" (ByVal hdc As Long) As Long
Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
Private Declare Function GetLastError Lib "kernel32" () As Long
Private Declare Function GetStockObject Lib "gdi32" (ByVal nIndex As Long) As Long
Private Declare Function Rectangle Lib "gdi32" (ByVal hdc As Long, ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Private Sub cmdWhiteRect_Click()
Dim di&
di = SelectObject(CompDC, GetStockObject(0))
di = Rectangle(CompDC, 0, 0, 50, 50)
cmdUpdate_Click
End Sub
Private Sub cmdRandom_Click()
Dim x&
Dim usex&, usey&
Dim di&
With binfo.bmiHeader
' Faster to access width & height in structure than pic properties