これは私が現在行っていることです:
- 経由でウィンドウ DC を取得する
GetWindowDC
- で互換性のある DC を作成します
CreateCompatibleDC
GetPixel
互換性のある DC で通話する
残念ながら、私の GetPixel 呼び出しはすべて を返していCLR_INVALID
ます。これが私のコードです。
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;
}
何か案は?