打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
Windows 8: TopMost vs. TopMost | Pavel's Blog

In Windows, a Window can be made topmost, by setting an extended style with the value WS_EX_TOPMOST (8), typically provided to CreateWindowEx. A topmost window is always on top of non-topmost windows. Among all topmost windows, the normal z-order rules apply. That is, until Windows 8.

A Metro application is built with a topmost window – that makes perfect sense. What about desktop apps? Here’s an empty desktop snapped with a metro app (the desktop itself can be seen as a kind of metro app):

Now let’s open Task Manager and make it topmost (Options / Always On Top). Slide it across the dividing snap bar and Task Manager is happy to be on top of the metro app:

Curiously, clicking on the metro app window does not make Task Manager any less topmost. Now let’s open Process Explorer and make it topmost as well (Options / Always On Top). Slide it over the metro app window, and this is the result:

It seems its topmost attribute is less powerful than Task Manager’s or the metro window! That’s certainly a surprise. It turns out Task Manager is “special” – I couldn’t find any other window that can stay on top of a metro app window – or on top of Task Manager for that matter.

Maybe Task Manager has a new “secret” style bit that makes it “super topmost”. Let’s open Spy++ and select Spy / Find Window from the menu:

Dragging the “Finder Tool” over Task Manager’s main window and clicking ok, shows this in the Styles tab:

The extended style is 0x108, which is WS_EX_TOPMOST | WS_EX_WINDOWEDGE – the latter being a minor appearance adjustment, irrelevant for our purposes. It looks like a regular WS_EX_TOPMOST. Let’s try the same with the Metro window.

Dragging the Finder Tool over the metro window “doesn’t stick” for some reason. Dragging Process Explorer’s equivalent tool manages to pinpoint the process to which this window belongs (WWAHost.exe, meaning that app was written in HTML/JS), but it doesn’t give out the window handle. So, how can we get the window handle of that metro app?

I decided to try calling the simple WindowFromPoint function, that I’m pretty sure Process Explorer uses as well (I was also sure Spy++ does that, though I can’t understand why it fails to see the window):

  1. POINT pt = { 40, 40 };
  2. HWND h = ::WindowFromPoint(pt);

That worked. I got a handle and typed it into Spy++ handle text box. It turns out this window is a child window, so I navigated to its parent (that window’s name was “Store”) and finally to its parent with is the top level window. These are its properties:

The only extended style is WS_EX_TOPMOST. How about Process Explorer’s window?

Pretty much the same. So they all have the same extended style bit (WS_EX_TOPMOST), but Task Manager and the Metro window behave as “super topmost” in relation to other topmost windows. Task Manager’s window seems to be the strongest topmost ever. So far, I don’t know how that is configured.

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
Delphi:窗体的扩展样式GWL
说说 HWND_TOP 和 HWND_TOPMOST 的区别
如何在win7下装win8以及我的win8之旅
关于WS_CLIPCHILDREN和WS_CLIPSIBLINGS的理解
Resize MDI Child Frame Windows to Fit Form Views
GWL
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服