开发者

How to write Windows 7 gadget in C#?

开发者 https://www.devze.com 2023-02-21 13:44 出处:网络
How can I use C# to write a gadget in Windows 7? Is it pos开发者_JS百科sible?http://www.codeproject.com/KB/gadgets/CPRepWindowsGadget.aspx

How can I use C# to write a gadget in Windows 7?

Is it pos开发者_JS百科sible?


http://www.codeproject.com/KB/gadgets/CPRepWindowsGadget.aspx

And a search on codeproject shows even more: http://www.codeproject.com/search.aspx?q=gadget&sbo=kw


Is Sidebar gadgets what you are looking for?

Have a look at this Silverlight trick!


Assuming that "Windows Sidebar Gadgets" are being talked about, this is not possible to do directly. However there are some work-abouts (none of which are supported by Microsoft):

  1. Use Silverlight. However, as I recall, the background can't be "painted transparent" and this will not work with a 64-bit IE (the IE running gadgets isn't always 32-bit by default) as there is no 64-bit Silverlight. This is the same problem plaguing sidebar gadgets that use Flash. (Like Pandora, one could require avid users to launch the 32-bit version of sidebar.exe).

  2. Wrap the gadget window. I started work on a project like this that allowed WPF (in a separate process) to "overlay" the gadget window -- started via COM. Avoids 32/64-bit issues (actually, doesn't matter since it's in a separate process and is CLR, not Silverlight). Some issues with default gadget border, sizing, properties, etc. Concept work only.

  3. Use an embedded HTA to launch a 32-bit IE and grab that handle (can then use/embedd Silverlight if launched the 32-bit version). I didn't have success with this, but it "should work".

  4. Use a converter like Script# -- write in C#, "compile" to JavaScript.

Happy coding.

0

精彩评论

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

关注公众号