Hi Elliot,
I haven't had time to look very closely at your post. But it looks as you're trying to create a bitmap image using the clipboard. I've done this directly (no clipboard), but for 16 and 256 colors, had to hard code the RGBQuad arrays in order to store them in files. In other words, I never could get Windows to properly return the values I needed to correctly create the bitmap.
Two comments, however:
First, you don't need to convert the hexadecimal values use either:
SRCCOPY = 0x00CC0020
or
#DEFINE SRCCOPY 0x00CC0020
Second, and I'm sure that you know this, The values returned by GetWindowRect() are absolute (they're relative to the desktop's 0, 0).
I'll take a closer look at your code, and if I find anything, I'll post back.
George
Ubi caritas et amor, deus ibi est