我HOOK了 BitBlt 这个函数 想通过WindowFromDC(hdcDest)获得目标窗口句柄,为什么每次得到的都是NULL,总是得不到目标窗口的句柄. 望高手解答
BitBlt(HDC hdcDest, // handle to destination device context
  int nXDest,  // x-coordinate of destination rectangle's upper-left        // corner
  int nYDest,  // y-coordinate of destination rectangle's upper-left           // corner
  int nWidth,  // width of destination rectangle
  int nHeight, // height of destination rectangle
  HDC hdcSrc,  // handle to source device context
  int nXSrc,   // x-coordinate of source rectangle's upper-left           // corner
  int nYSrc,   // y-coordinate of source rectangle's upper-left             // corner
  DWORD dwRop )

解决方案 »

  1.   

    看看你的窗口是不是可见或别的什么属性,所我所知QQ2009的子窗口,你用WindowFromDC是获取不到窗口句柄的
      

  2.   

    可能是Compatible DC(内存兼容DC),
    HDC hdcDest,HDC hdcSrc,其中之一应该有个是 关联了窗口的DC
      

  3.   

    两个我都试过了,得到的都是NULL
      

  4.   

    尝试用int GetClipBox(HDC hdc ,LPRECT lprc);试试获取HDC的剪切区域,然后再用别的方法去获取那个窗口句柄(比如EnumWindows等),将HDC获取到的RECT与窗口对应的RECT比较