Pin WPF window on the desktop in Windows 7

半世苍凉 提交于 2019-12-14 03:03:43

问题


I want to pin a WPF window on the desktop (it should be a desktop gadget).

I know you can do this by setting the parent handle of the WPF window to the handle of the "progman" window.

But this does not prevent the hiding of the WPF window when "Windows + D" is pressed.

There must be another way do to this. The new desktop gadgets in Windows 7 are not hidden when "Windows + D" is pressed. How did the MS developers achieve this?


回答1:


I think your best bet would be to create a Gadget and host your WPF using either of the following options

1- WPF hosted using an IFrame.
WPF Vista Gadgets - Part 1: Using XBAP and IFRAME

2- WPF hosted in the Gadget using ActiveX
http://blogs.msdn.com/karstenj/archive/2006/10/09/activex-wpf-gadget.aspx
http://blogs.msdn.com/jaimer/archive/2006/10/02/writing-a-.net-activex-control-for-your-sidebar-gadget_2E002E00_.aspx

The linked articles are for Vista but the concepts should be the same since Windows 7 gadgets are backwards compatible with Vista gadgets.




回答2:


Try this

  1. Create a XBAP Application in VS.

  2. Follow the standard pattern of a Window Gadget.

  3. Call the XBAP app exe from java script in the web page.

  4. Finally zip your directory structure and change its extension to .gadget

your wpf gadget is ready to deploy



来源:https://stackoverflow.com/questions/2794612/pin-wpf-window-on-the-desktop-in-windows-7

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!