需要使用MFC控件创建警告弹出窗口 [英] Required to create warning pop-up using MFC controls
问题描述
我想创建一个警告弹出框而不是阻止弹出框。
这意味着当弹出对话框出现时我应该仍然能够点击其他控件但是在我的场景中我必须单击OK按钮而不是弹出 - 向上窗口将消失,我可以点击其他控件,但我不想这样。
即使弹出窗口存在,我应该可以点击在窗户的另一边。
有谁可以帮我解决这个问题?
问候,
我尝试过:
在我的代码中我直接使用了AfxMessageBox (Some String。当我点击某个按钮时,它将直接进入这个方法,并在内部调用windows api。但是这个api给了我阻止弹出窗口,它不允许我点击任何地方直到我按下Ok按钮在弹出窗口中。
I wanted to create a warning pop-up box instead of a blocking pop.
It means when the pop-up dialog comes i should be still able to click on other controls but in my scenario i have to click OK button than only the pop-up window will go away and am able to click on other controls but i don't want that.
Even though pop-up is existing i should be able to click on other sides of windows.
Can anyone help me in this issue?
Regards,
What I have tried:
In my code i have directly used AfxMessageBox("Some String). When i click on some button it will directly come to this method and it calls internally windows api's. But this api gives me blocking pop-up window it won't allow me to click anywhere until i press Ok button in the pop-up window.
推荐答案
你要找的是一个无模式(或非模态)对话框。
您必须创建一个对话框适用于普通(模态)对话框的框模板。但不是使用DoModal()
,而是必须使用Create()
和ShowWindow()
。
使用无模式对话框还可以观察到更多内容;特别是存储实例的地方,通常是为了避免创建多个实例。
相当古老但仍然有效的链接:教程 - 使用MFC的无模式对话框 [ ^ ] -
What you are looking for is called a modeless (or non-modal) dialog box.
You have to create a dialog box template for those like for normal (modal) dialog boxes. But instead of usingDoModal()
you have to useCreate()
andShowWindow()
.
There are also more things to observe with modeless dialogs; especially where the instance is stored and usually to avoid multiple instances to be created.
A rather old but still valid link: Tutorial - Modeless Dialogs with MFC[^]-
这篇关于需要使用MFC控件创建警告弹出窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!