如何访问桌面窗口

来源:互联网 发布:ssl默认端口号 编辑:程序博客网 时间:2024/05/21 09:54
静态函数CWnd:: GetDesktopWindow 返回桌面窗口的指针。下例说明了MFC
void CFrameWnd::BeginModalState ()
{
     //first count all windows that need to be disabled
     UINT nCount=0;
     HWND hWnd=:: GetWindow (:: GetDesktopWindow (), GW_CHILD);
     while (hWnd!=NULL)
     {
        if (:: IsWindowEnabled (hwnd) &&
            CWnd::FromHandlePermanent (hWnd)!=NULL &&
            AfxIsDescendant (pParent->m_hWnd, hWnd) &&
            :: SendMessage (hWnd, WM_DISABLEMODAL, 0, 0)==0)
        {
            ++nCount;
        }
        hWnd=:: GetWindow (hWnd, GW_HWNDNEXT);
     }
原创粉丝点击