Link to home
Start Free TrialLog in
Avatar of AnitraZ
AnitraZ

asked on

Handles

Hello. I'm trying to copy BMP data (32bpp) from an array to an StdPicture object. I found many examples on the net, I see that using GDI I can easily handle this, but...

hDCSrc=GetDC(0)
hDCMemory=CreateCompatibleDC(hDCSrc)
hBmp=CreateCompatibleBitmap(hDCSrc, Width, Height)
hBmpPrev=SelectObject(hDCMemory, hBmp)

Call BitBlt(hDCMemory, 0, 0, Width, Height, hDCSrc, 0, 0, vbSrcCopy)
hBmp=SelectObject(hDCMemory, hBmpPrev)
[...]

This code looks very fast, but what are all those handles? I mean, I create a compatible DC, right? Then I should set the array to that DC, using SetBitmapBits(). And then I call OleCreatePictureIndirect(). But in the example above this doesn't happens. It gets a DC from 0 (???), then selects something, getting another handle... An then uses BitBlt (not SetBitmapBits), and again, SelectObject. What are all those handles? I'll be glad if you could explain me those API calls, or at least what the a handle is. Thanks.

AnitraZ
ASKER CERTIFIED SOLUTION
Avatar of JohnMcCann
JohnMcCann

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of AnitraZ
AnitraZ

ASKER

K, thank you. Now the code looks different, I hope I'll success in moving the bitmap for array to StdPicture.

AnitraZ