开发者

Opposite of "always on top"

开发者 https://www.devze.com 2022-12-22 05:55 出处:网络
I want to set my application to be on desktop level, like Windows Gadgets. Is this possib开发者_C百科le to achieve?

I want to set my application to be on desktop level, like Windows Gadgets. Is this possib开发者_C百科le to achieve?

Thing is, i have borderless application I want to run on desktop.

I tried to find the option, but I found only "always on top" which is opposite of what I want to achieve.


The good old SetWindowPos supports a HWND_BOTTOM to place your application as the last one in the order. To use it in C# take a look at PInvoke.Net.


Write the app so that it runs as a service in the background, then implement an actual Windows Gadget as a front-end?


i think there is no way to do it same way as always on top. do you want to run your application under icons? the only way to do a really background application is to replace explorer.exe, but then you will not see icons and task bar.


You can implement an actual Windows Gadget using WPF by creating an XBAP. Just add a gadget.xml file and an .html file that contains only an IFRAME that loads the XBAP. That way your WPF application will actually be a gadget and will automatically follow all the rules.

Another option is to use Windows Sidebar Styler. This requires additional software to be installed alongside yours but also allows you to do things you can't do inside the XBAP sandbox without code signing certificates, user authorizaiton, etc.

A third option is to create a gadget that uses something recognizable in the HTML (such as a particular background color), then when your .exe starts up, scan for a hWnd under Explorer that has the attributes you are looking for, inject yourself into the Explorer.exe process, and set your window as a child of it.

A variation of the third option is to not inject into Explorer.exe but rather maintain your Z Index and location (using SetWindowPos) to track the Z Index and location of the hWnd you found.

So many choices...

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号