【发布时间】:2016-11-16 16:00:11
【问题描述】:
我有一个简单的 MFC 对话框类型窗口,它调用外部 dll 函数,参数之一是回调函数。如果未创建回调函数,则会创建另一个对话框窗口,并使用函数参数中的信息更新标签:
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
}
回调期间显示对话框形式,标签显示所需信息。但是,如果我尝试用鼠标移动表单,它会像下图一样冻结,并且标签上的信息不再更新。为什么会发生这种情况?如何解决这个问题?
【问题讨论】:
标签: visual-c++ mfc