AfxMessageBox 在后台运行 [英] AfxMessageBox going on background

查看:59
本文介绍了AfxMessageBox 在后台运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在连接检查中,我显示了一个模式对话框以确保连接.但是为了让人们摆脱模态对话框,我想要一个消息框来保持尝试连接或退出应用程序.

In a connection check i am showing a modal dialog to ensure the connection. But to give people escape from the modal dialog i want to a message box to keep try connection or exit the application.

void CRoboVibMainFrame::OpenSystemSettingsDialog(int activeTabIndex /*= 0*/)
{

while (activeTabIndex >= 0)
{
    m_settingsDialog = std::make_unique<SettingsDialog>(this,activeTabIndex);
    m_settingsDialog->DoModal();
    activeTabIndex = GetNotConnectedPSVControl();
    if (AfxMessageBox(Polytec::Text::ToMessageString(IDS_PSV_SYSTEM_EXIT_WINDOW_MSG), MB_YESNO) == IDNO)
    {
        ::ExitProcess(0);
        break;
    }
}
}

但是消息框总是显示在后台.我想要它在前面.我的代码有什么问题?请提出建议.

But the Messagebox is alway showing in the background. I want it on front. What is wrong in my code? Please suggest.

推荐答案

我能够通过此修复将 AfxMessageBox 置于最前面:

I was able to bring the AfxMessageBox to front by this fix :

CWnd::PostMessage(WM_SYSKEYDOWN);

CWnd::PostMessage(WM_SYSKEYDOWN);

我不确定这是否是唯一的方法.但它解决了我的问题.这可以帮助某人.

I am not sure if this is the only way. But it fixed my issues. This can help someone.

这篇关于AfxMessageBox 在后台运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆