on VB6 i have these code for create a memory DC:
Public Sub CreateMemoryBitmap(ByVal Width As Long, ByVal _
Height As Long)
If (ImageWidth > 0 Or ImageHeight > 0) Then DeleteMemoryBitmap
ImageWidth = Width
ImageHeight = Height
' Create the device context.
hdc = CreateCompatibleDC(ByVal 0&)
If (hdc = 0) Then Debug.Print "no HDC"
' Create the bitmap.
HBitmap = CreateCompatibleBitmap(hdc, ImageWidth, _
ImageHeight)
If (HBitmap = 0) Then Debug.Print "no HBITMAP"
' Make the device context use the bitmap.
OldHDC = SelectObject(hdc, HBitmap)
DrawLine 0, 0, 100, 100, vbBlack
End Sub
i test if the hdc is created, but no error.. but i get bad results.. i belive the DC\HBitmap are created incorrectly :(