CDC bitblt function with HDC parameter?
-
Hi,I wonder how a bitblt function of a CDC object, which src is a HDC object? like:
MemDC.BitBlt(Icon.pos_x, Icon.pos_y, bm.w, bm.h,HdcObject,0,0,SRCCOPY);
Quote:
which src is a HDC object?
What? That doesn't make sense. Try rephrasing or expand on what you're trying to ask.
-
Quote:
which src is a HDC object?
What? That doesn't make sense. Try rephrasing or expand on what you're trying to ask.
-
I mean HdcObject in the code. I just want to copy a HDC object to CDC object, use CDC object's BitBlt() function.
HDC is a handle not an object.... You can use CDC::FromHandle() to get a temporary object for immediate use. Alternatively, you can CDC::Attach() to keep a more permanent CDC object around. You should make sure you release a device context (DC) when you're done using it (FromHandle sort of automatically handles this situation by going out of scope). If you have CWnds, you can also get a pointer to an existing CDC with CWnd::GetDC(). There is a lot of info on drawing in GDI online, I suggest you read up on it.