   GetPixel()
  Hi all. I am trying to get the color values for a window.HDC dc = GetDC(hwnd);HBITMAP bit = CreateCompatibleBitmap(dc,793, 547);SelectObject(dc, bit);COLORREF pix = GetPixel(dc, 10, 10);GetPixel returns CLR_INVALID.  The documentation for GetPixel says something about selecting an object which is what im trying to do with selectobject but I'm not sure if its correct.  Any help would be great thanks!   
  You might try drawing something there first before you try to look at it? :)   ;  You might want to try commenting outHBITMAP bit = CreateCompatibleBitmap(dc,793, 547);SelectObject(dc, bit);those lines becuase GetDC will return a valid handle to the windows device context.You don't need to create a bitmap for it.   ;  I tried commenting out those two lines but it didn't work. I also tried calling SetPixel() and that worked ok.   ;  Have you tried GetWindowDC() Instead of GetDC()OrIs the window handle valid?   