MFC中的问题记录 2012220

  1. 模态窗体的实现

    bool CWindowWnd::ShowModal()
    {
       ASSERT(::IsWindow(m_hWnd));
       
       HWND hWndParent = GetWindowOwner(m_hWnd);
       ::ShowWindow(m_hWnd, SW_SHOWNORMAL);
       ::EnableWindow(hWndParent, FALSE);
       MSG msg = { 0 };
       while( ::IsWindow(m_hWnd) && ::GetMessage(&msg, NULL, 0, 0) ) {
          if( msg.message == WM_CLOSE ) {
             ::EnableWindow(hWndParent, TRUE);
             ::SetFocus(hWndParent);
          }
          if( !CPaintManagerUI::TranslateMessage(&msg) ) {
             ::TranslateMessage(&msg);
             ::DispatchMessage(&msg);
          }
          if( msg.message == WM_QUIT ) break;
       }
       ::EnableWindow(hWndParent, TRUE);
       ::SetFocus(hWndParent);
       if( msg.message == WM_QUIT ) ::PostQuitMessage(msg.wParam);
       return true;
    }
    


  2. 谈谈父窗口和所有者窗口
  3. WM_NCCREATE
  4. GWLP_USERDATA
    Sets the user data associated with the window. This data is intended for use by the application that created the window. Its value is initially zero.
  5. 《C++设计新思维》读书笔记
原文地址:https://www.cnblogs.com/Clingingboy/p/2359985.html