4

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

Is it possible?

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278
Gali
  • 14,511
  • 28
  • 80
  • 105
  • This looks like a duplicate question. See: http://stackoverflow.com/questions/5285715/create-windows-desktop-gadget. – Joel Lee Apr 01 '11 at 05:59
  • It is not a duplicate. This asks how to do it in C#. Sidebar Gadgets only "support" JavaScript/HTML. –  Apr 01 '11 at 06:04

3 Answers3

5

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

EKS
  • 5,543
  • 6
  • 44
  • 60
1

Is Sidebar gadgets what you are looking for?

Have a look at this Silverlight trick!

Emond
  • 50,210
  • 11
  • 84
  • 115
1

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.

Community
  • 1
  • 1