View Single Post
Old Feb 22nd, 2008, 6:13 PM   #1
null_ptr0
12 years old
 
Join Date: Nov 2007
Posts: 94
Rep Power: 1 null_ptr0 is on a distinguished road
[win32][gdi32] Copying HDC to another?

I've tried to do CreateCompatibleDC(source_device) but it contains a result the same height and size as source_device but every pixel as black. Any help?
const int SCREEN_WIDTH = GetSystemMetrics(SM_CXSCREEN) - 1;
const int SCREEN_HEIGHT = GetSystemMetrics(SM_CXSCREEN) - 1;
...
    int x;
    HDC screen_device = GetDC(NULL);
    HDC copy = CreateCompatibleDC(screen_device);
    for (x = 0; x <= SCREEN_WIDTH; ++x) {
        for (int y = 0; y <= SCREEN_HEIGHT; ++y) {
            SetPixel(screen_device, x, y,  GetPixel(copy, SCREEN_WIDTH - x, y));
        }
    }
...

EDIT:
I see I have to use BitBlt? If so, may I have an example? I have an inefficiency in understanding win32 argument names.
null_ptr0 is offline   Reply With Quote