This is what I am currently doing:
- get window DC via
GetWindowDC
- create a compatible DC with
CreateCompatibleDC
- call
GetPixel
on my compatible DC
Unfortunately, all of my GetPixel calls are returning CLR_INVALID
. Here is my code.
bool Gameboard::Refresh()
{
bool ret = false;
HDC context, localContext;
context = GetWindowDC(m_window);
if (context != NULL)
{
localContext = CreateCompatibleDC(context);
if (localContext != NULL)
{
if (BitBlt(localContext, 0, 0, GameboardInfo::BoardWidth, GameboardInfo::BoardHeight,
context, GameboardInfo::TopLeft.x, GameboardInfo::TopLeft.y, SRCCOPY))
{
ret = true;
// several calls to GetPixel which all return CLR_INVALID
}
DeleteDC(localContext);
}
ReleaseDC(m_window, context);
}
return ret;
}
Any ideas?