zoukankan      html  css  js  c++  java
  • 解决主框架最小化后弹出对话框消失的问题

    1、之前看过网上的高手写的有关Owner窗口与Owned窗口、父窗口与子窗口中的关联;

      Owner关系的窗口。

            Owner窗口隐藏,子窗口不会隐藏。

            Owner窗口最小化,子窗口隐藏。

        Parent关系的窗口。

             Parent窗口隐藏,子窗口隐藏。

             Parent窗口最小化,子窗口隐藏。

     理论上这个问题是没办法解决的,只能通过建立独立窗口;

    今天无意中竟然被我尝试出了一种办法解决这个问题

    通过CWinThread创建一个UI线程,在此UI线程中动态创建非模式对话框,其父为桌面,并把对话框的句柄赋予线程的主句柄;

    BOOL CCalcTimerThread::InitInstance()
    {
     // TODO: 在此执行任意逐线程初始化
     if(m_pDlgTimer!=NULL)
     {
      m_pDlgTimer->DestroyWindow();
      delete m_pDlgTimer;
      m_pDlgTimer=NULL;
     }
     //if(m_pOwnerWnd==NULL)
     // m_pOwnerWnd = this->m_pMainWnd;
     HWND  hDesktop  =  ::FindWindow("Progman",  NULL);
     hDesktop  =  ::GetWindow(hDesktop,  GW_CHILD);
     CWnd*  pWndDesktop  =  CWnd::FromHandle(hDesktop);
     //this->SetParent(pWndDesktop);
     m_pDlgTimer = new CCalcTimer();
        m_pDlgTimer->SetCurrentUIThreadID(m_nThreadID);
     m_pDlgTimer->Create(IDD_DLG_TIMER,pWndDesktop);
     m_pDlgTimer->SetWindowPos(&(CWnd::wndNoTopMost),0,0,0,0,SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE);
     //m_pDlgTimer->ShowWindow(SW_SHOW);
     this->m_pMainWnd = m_pDlgTimer;
     return TRUE;
    }

  • 相关阅读:
    HDU 1060 Leftmost Digit
    HDU 1008 Elevator
    HDU 1042 N!
    HDU 1040 As Easy As A+B
    HDU 1007 Quoit Design
    欧拉函数
    HDU 4983 Goffi and GCD
    HDU 2588 GCD
    HDU 3501 Calculation 2
    HDU 4981 Goffi and Median
  • 原文地址:https://www.cnblogs.com/liuliu-NoGirl/p/4029536.html
Copyright © 2011-2022 走看看