OK here's the score, I've created two device contexts and loaded a bitmap using the LoadImage API. I'm now 'selecting' the bitmap into the first DC and the BitBlt'ing it into the second DC but when I try to BitBlt this DC to the form for testing I get nothing.
This is the troublesome code:
VB Code:
'Create a copy of the original bitmap so it can be masked Dim hbmCopy As Long, hdcCopy As Long hDC = CreateCompatibleDC(0) hdcCopy = CreateCompatibleDC(0) hbmCopy = CreateCompatibleBitmap(0, 16, 16) 'Select the original image SelectObject hDC, m_hbmMain 'SelectObject hdcCopy, hbmCopy 'BitBlt the original into the copy DC Debug.Print "copying from ", hDC, "to", hdcCopy Debug.Print "result:", BitBlt(hdcCopy, 0, 0, 16, 16, hDC, 0, 0, vbSrcCopy) 'See if we can BitBlt our copied one onto the form Debug.Print "bitblt onto form", BitBlt(Me.hDC, 16, 0, 16, 16, hdcCopy, 0, 0, vbSrcCopy) 'Refresh the form Me.Refresh DeleteObject hbmCopy DeleteDC hdcCopy DeleteDC hDC
I'll also attach the form incase anyone needs a closer inspection. When the command button is clicked 2 images of an apple should appear in the top-left corner.
Cheers for any help, adehh.




Reply With Quote