最上面的窗口 [英] Topmost window

查看:96
本文介绍了最上面的窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好.

我使用以下命令创建一个窗口:

SetWindowPos( hWnd ,HWND_TOPMOST, x, y, xx, yy, SWP_SHOWWINDOW | SWP_FRAMECHANGED );



现在,如果启动了任何其他最上面的窗口(例如Windows任务管理器),则单击该窗口会将其置于最前面.然后单击我的窗口会将最后一个显示在最前面.

是否可以创建一个始终位于以后创建的其他窗口之上的窗口? :)

[在前2个答案后编辑]
好吧...我会以其他方式提出一个问题,因为我还没有问过一个问题:我能创建最顶层的最顶层... ......(n + 1)*(最顶部)的窗口?" :)

想象一下,我的应用程序有2个窗口:W1和W2,它们都位于最顶部.
我想要的只是W1始终在W2之前.

当然,可能有一些if语句,但是我想知道是否有可能告诉系统控制这些窗口的位置.
[完]

Eugen Podsypalnikov写道:

不是这样吗?
对话框的对话框(W1),
由窗口(W2)创建吗?



不,这不是我要的. "W1"和"W2"彼此独立,因此打开W2时应该有可能在W1中操作,反之亦然.
在此先感谢

解决方案

否:这实际上是对用户耐心的一种滥用.
如果一切都想成为最高点,那么什么也不会是最高点.

如果所有devclopers都希望成为最高层中最高层中的最高层",那么甚至引入另一个类别-另一个-另一个...-都会在一段时间后转移相同的问题!

故事的寓意:让用户根据自己的操作来决定哪个窗口最顶部",哪些不是最顶部".


它不会出现.我已经按照您的描述进行了测试,看来一个TOPMOST窗口会以其自己的Z顺序进入一个新的组.由于它们都在争夺最高地位,因此用户可以随时单击所需的那个.如果Windows具有另一个值,例如ABSOLUTE_TOPMOST您仍然可以使用该属性创建多个窗口.

您的补充性问题的答案仍然是否".阅读MSDN文档;任意数量的窗口都可以是TOPMOST窗口,但是用户仍然可以选择其中哪个窗口应位于该组的顶部.请记住,您正在编写要由用户控制的应用程序(否则为什么要使用Windows?),并且该用户需要能够确定哪个窗口应保留在组的顶部.


bartello写道:

想象一下,我的应用程序有2个窗口:W1和W2,并且它们都是最高的.
我只想让W1始终位于W2之前.



不是这样吗?
对话框的对话框(W1),
由窗口(W2)创建? :)


bartello写道:

因此,应该在W2打开时在W1中进行操作,反之亦然



有可能
在W1(一个窗口)中操作
在打开W2(其模态对话框)时
反之亦然:)


Hi all.

I create a window using the following:

SetWindowPos( hWnd ,HWND_TOPMOST, x, y, xx, yy, SWP_SHOWWINDOW | SWP_FRAMECHANGED );



Now if any other topmost window (for example Windows Task Manager) is launched the click on that window will bring it to the front. Then clicking on my window will bring the last to the front.

Is it possible to create a window that will always be over other windows which are created later? :)

[Edited after first 2 answers]
Well... I''ll ask a question in other way, cause I''ve not asked a question "can I create most topmost of the top of the most topmost ...... (n+1)*(of the most topmost) window?" :)

Imagine that my application has 2 windows: W1 and W2, and they both are topmost.
All I want is W1 to be always in front of W2.

Of course it is possible having for example some if statements, but I wanna know if it is possible to tell the system to control these windows positions.
[End]

Eugen Podsypalnikov wrote:

Would it be not a case
of a modaless dialog (W1),
created by a window (W2) ?



No, this is not what I ask. "W1" and "W2" are independent from each other, so there should be possibility to operate in W1 while W2 is opened and vise versa/>



thanks in advance

解决方案

No: this is in fact an abuse of user patience.
If everything want to be topmost nothing will be topmost.

An even introducing another category - and another - and another ... -will just shift the same problem after some time if all devclopers want to be the "most topmost of the top of the most topmost"!

Moral of the story: let the user to decide which window is "topmost" and what is not, depending on what he''s doing.


It would appear not. I have just tested as you described and it would appear that more than one TOPMOST window goes into a new group with their own Z-order. Since they are all competing to be topmost it is up to the user to click on the one that is wanted at any time. If windows had another value e.g. ABSOLUTE_TOPMOST you could still create multiple windows with the property.

The answer to your suplementary question is still "No". Read the MSDN documentation; any number of windows can be TOPMOST windows, but the user still has the choice of which one of them should be at the top of that group. Remember you are writing an application that is to be controlled by the user (otherwise why use Windows?) and that user needs to be able to decide which Window should remain at the top of the group.


bartello wrote:

Imagine that my application has 2 windows: W1 and W2, and they both are topmost.
All I want is W1 to be always in front of W2.



Would it be not a case
of a modaless dialog (W1),
created by a window (W2) ? :)


bartello wrote:

so there should be possibility to operate in W1 while W2 is opened and vise versa



It would be possible
to operate in W1(a window)
while W2(its modaless dialog) is opened
and vise versa :)


这篇关于最上面的窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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