在 TOPMOST window 之后放置一个 window
Placing a window after TOPMOST window
我有一个 window,它是 TOPMOST,我有另一个 (myWindow) window,我想放在第一个后面,我不想要第二个 window成为最重要的:
SetWindowPos(topMostWin, HWND_TOPMOST, left, top, width, height, flags);
LONG_PTR exstyle = ::GetWindowLongPtr(myWindow, GWL_EXSTYLE);
if (exstyle & WS_EX_TOPMOST)
{
exstyle &= ~WS_EX_TOPMOST;
if( ! ::SetWindowLongPtr(myWindow, GWL_EXSTYLE, exstyle))
{
LOG_ERROR();
}
}
SetWindowPos(myWindow, topMostWin, left, top, width, height, flags);
但是 myWindow 一直表现得像最顶层 window,当我检查 myWindow 的 WS_EX_TOPMOST
属性 扩展样式时,它仍然处于打开状态。即使我将 window 放在最顶层 window 之后,是否可以关闭最顶层位?
HWND_TOP 会将您的 window 置于 z-order 的顶部,位于任何最顶部的 windows 之后。
As a result of the introduction of “topmost” windows, HWND_TOP now brings
the window “as high in the Z-order as possible without violating the
rule that topmost windows always appear above non-topmost windows”.
What does this mean in practice?
- If a window is topmost, then HWND_TOP puts it at the very top of the Z-order.
- If a window is not topmost, then HWND_TOP puts it at the top of all non-topmost windows (i.e., just below the lowest topmost window,
if any).
Note: The above discussion completely ignores the issue of owner and
owned windows. I left them out because they would add a layer of
complication that distracts from the main topic.
*Raymond Chen - The Old New Thing*
还有什么好说的? ...
我有一个 window,它是 TOPMOST,我有另一个 (myWindow) window,我想放在第一个后面,我不想要第二个 window成为最重要的:
SetWindowPos(topMostWin, HWND_TOPMOST, left, top, width, height, flags);
LONG_PTR exstyle = ::GetWindowLongPtr(myWindow, GWL_EXSTYLE);
if (exstyle & WS_EX_TOPMOST)
{
exstyle &= ~WS_EX_TOPMOST;
if( ! ::SetWindowLongPtr(myWindow, GWL_EXSTYLE, exstyle))
{
LOG_ERROR();
}
}
SetWindowPos(myWindow, topMostWin, left, top, width, height, flags);
但是 myWindow 一直表现得像最顶层 window,当我检查 myWindow 的 WS_EX_TOPMOST
属性 扩展样式时,它仍然处于打开状态。即使我将 window 放在最顶层 window 之后,是否可以关闭最顶层位?
HWND_TOP 会将您的 window 置于 z-order 的顶部,位于任何最顶部的 windows 之后。
As a result of the introduction of “topmost” windows, HWND_TOP now brings the window “as high in the Z-order as possible without violating the rule that topmost windows always appear above non-topmost windows”. What does this mean in practice?
- If a window is topmost, then HWND_TOP puts it at the very top of the Z-order.
- If a window is not topmost, then HWND_TOP puts it at the top of all non-topmost windows (i.e., just below the lowest topmost window, if any).
Note: The above discussion completely ignores the issue of owner and owned windows. I left them out because they would add a layer of complication that distracts from the main topic.
*Raymond Chen - The Old New Thing*
还有什么好说的? ...