1
我有簡單的MFC對話框類型窗口調用外部DLL函數,其中一個參數是回調函數。回調函數創建了另一個對話框如果不創建它,並從功能參數信息更新標籤:MFC對話框窗體凍結
int userNotify (int iNotificationType, char* pcNotificationText)
{
if(statusDlg)
{
if (!(statusDlg->IsWindowVisible()))
{
statusDlg->ShowWindow(SW_SHOW);
}
statusDlg->showNotification(iNotificationType,pcNotificationText);
} else
{
statusDlg = new StatusDlg(NULL);
statusDlg->Create(StatusDlg::IDD,CWnd::GetDesktopWindow());
statusDlg->ShowWindow(SW_SHOW);
statusDlg->showNotification(iNotificationType,pcNotificationText);
}
return 0;
}
statusDlg是全局變量,是非常簡單的MFC對話框的形式與一個靜態的標籤。它有一個特點 - 它放在最上面。
BOOL StatusDlg::OnInitDialog()
{
staticStatus = (CStatic*)GetDlgItem(IDC_STATIC_TRN_STATUS_DIALOG);
...
SetWindowPos(&this->wndTopMost,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE);
return TRUE; // return TRUE unless you set the focus to a control
}
對話窗體在回調期間顯示,標籤顯示所需的信息。但是,如果我嘗試使用鼠標移動窗體,就會像下面的圖片一樣凍結,並且標籤上的信息不再更新。爲什麼會發生?如何解決這個問題呢?