lundi 20 avril 2015

mfc dialog opens only after mouse move when using QT

I have an interesting issue. My MFC dialog CManageDlg is calling another MFC dialog CmyMfcDlg using this call, on press of a button

    void CManageDlg::OnBnClickedBt()
    {
        CmyMfcDlg ipmfc;
        if ( ipmfc.DoModal() != IDOK )
        {
            return MyError;
        }
    }

Here is :

BOOL CmyMfcDlg ::OnInitDialog() 
{
    AFX_MANAGE_STATE(AfxGetStaticModuleState());
    CDialog::OnInitDialog();
    CString tmpStr;
    UpdateData(FALSE);

   CDC  dc;
   dc.Attach(::GetDC(this->m_hWnd));

   int  mx = dc.GetDeviceCaps(HORZRES);
   int  my = dc.GetDeviceCaps(VERTRES);
   // lots of initializations 
}

The problem is once OnBnClickedBt() is triggered by press of a button (ON_BN_CLICKED), CmyMfcDlg wait and does not open until mouse is moved! I do not know how these two are connected. I meant mouse move and opening the dialog.

EDIT: it turns out that this issue only happened when using QT User Interface, if I called the same function using UI written in MFC, it works fine with no problem!

Aucun commentaire:

Enregistrer un commentaire