• ### Popular Now

• 13
• 27
• 9
• 9
• 20

#### Archived

This topic is now archived and is closed to further replies.

# DIB Section creation blanks the hDC ?

This topic is 5385 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

i am trying to save the hdc to a bitmap file, and i''m trying to: create a dib section with the dc, combining it with the dc, and then get the pixels from that dc with getdibits, and then save the bmp header stuff to the file, followed by the pixels. Code:
    Dim bmpH As BITMAPINFO_NoC
.biBitCount = 32
.biPlanes = 1
.biWidth = W
.biHeight = H
.biSizeImage = (W * 4) * H
End With

Dim tBM As Long
tBM = CreateDIBSection(hDc, bmpH, DIB_RGB_COLORS, ByVal 0&, ByVal 0&, ByVal 0&)
Call SelectObject(hDc, tBM)

Dim Pixel() As Byte
ReDim Pixel(1 To 4, 1 To W, 1 To H)
GetDIBits hDc, tBM, 0, H, Pixel(1, 1, 1), bmpH, DIB_RGB_COLORS

Open File For Binary As #1
Put #1, , bmpH
Put #1, , Pixel
Close #1

i know it may be hard to notice anything by just looking at this code, but, if you have done something like this in the past, is there something i should know? thanx