获得鼠标当前所指窗口问题
dot99 2003-12-09 10:02:01 我有个程序,里面有如下的代码:
CWnd* wndTmp = WindowFromPoint(pt);
if (wndTmp == NULL) {
SetCursor(LoadCursor(NULL, IDC_ARROW));
ReleaseCapture();
return;
}
CWnd* wndParentTmp = wndTmp->GetParentOwner();
if (wndParentTmp == NULL)
wndParentTmp = wndTmp;
wndParentTmp->GetWindowText(strTitle);
1:当我鼠标指向桌面的时候,所得到的窗口是什么窗口?
我试验过(wndTmp == GetDesktopWindow()),值为FALSE
2:wndParentTmp = wndTmp->GetParentOwner();所得到的窗口又是什么?
下面的wndParentTmp->GetWindowText(strTitle)得到的是窗口标题是
"Program Manager",如果把这个窗口透明度调为0的话,整个桌面就黑了,100%透明的话恢复正常
3:是不是判断NULL的两个条件没有必要?因为总能获得一个窗口