简体   繁体   English

MFC:使对话框始终位于其他对话框的小集之上

[英]MFC: Make dialog always above A SMALL SET of other dialogs

Google-ing yields results on how to make a dialog "always on top" of everything. Google-ing产生了有关如何使对话框“始终位于一切之上”的结果。 This is not what I want, though. 不过,这不是我想要的。

Say I have a huge amount of dialogs. 说我有很多对话。 Within this pile of dialogs, consider 3 of them -- A, B and C. 在这堆对话框中,考虑其中的三个-A,B和C。

I want C to always be on top of A and B, but not the rest of the pile. 我希望C始终位于A和B的顶部,而不是其余部分。 In other words, if C is active, then it should be on top, otherwise it will be below another active dialog, except for when it involves A and B. 换句话说,如果C处于活动状态,则它应位于顶部,否则它将位于另一个活动对话框的下方,除非涉及A和B。

And by the way, A and B can never appear at the same time. 顺便说一下,A和B永远不会同时出现。

With that, the only way I've managed to do it is by destroying C every time, and then re-create it with a new parent (A or B, depending who is visible). 这样,我设法做到的唯一方法是每次都销毁C,然后用新的父代(A或B,取决于谁可见)重新创建它。 I've learned that once child dialogs are created, the ownership cannot be transferred, hence the need to destroy. 我了解到,一旦创建了子对话框,就无法转让所有权,因此需要销毁。

I cannot afford to keep destroying it (long story to it). 我无法继续销毁它(长话不说)。

Any other way to achieve this? 还有其他方法可以做到这一点吗? Thanks! 谢谢!

With that, the only way I've managed to do it is by destroying C every time, and then re-create it with a new parent (A or B, depending who is visible). 这样,我设法做到的唯一方法是每次都销毁C,然后用新的父代(A或B,取决于谁可见)重新创建它。

If you have the handle to C's window in A or B, how about sending a user-defined message to C, when ever you want to set C as TopMost ? 如果您拥有A或B中C的窗口的句柄,那么当您要将C设置为TopMost时,如何向C发送用户定义的消息呢?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM