使用GetPixel无法取得一游戏画面的颜色,将游戏画面截图后识别正常!
但直接在游戏画面上得到的像素颜色不正确(可以保证坐标正确)! 
这是怎么回事?

解决方案 »

  1.   

    你的DC不是游戏窗口的DC,想办法首先得到游戏窗口CWnd,再从CWnd中得到DC,然后GetPixel
      

  2.   

    不是你说的问题.我直接使用Desktop的DC,对其它程序的窗口使用GetPixel都没问题.
      

  3.   

    COLORREF GetPixel(
      HDC hdc,    // handle to DC
      int nXPos,  // x-coordinate of pixel
      int nYPos   // y-coordinate of pixel
    );Res
    The pixel must be within the boundaries of the current clipping region. Not all devices support GetPixel. An application should call GetDeviceCaps to determine whether a specified device supports this function. 
      

  4.   

    游戏用了DirectX之类的硬件加速,GetPixel()就失效了.
    各种播放软件也是如此