Creating Windows SideShow Gadgets using Managed Code

The Windows SideShow Managed API 1.0 SDK installs and configures templates (C# and Visual Basic) and a new project wizard for Microsoft Visual Studio 2005 or Visual Studio 2008. Together, these components make it easy for you to create a new Windows SideShow gadget, while specifying particular features for your project. When you use the wizard it will generate new GUIDs for your gadget, where appropriate, which will ensure that the gadget is unique. While it is possible to create a gadget without using the wizard, we strongly recommended that you start all new gadgets from a project created by the wizard. You can install the Managed API 1.0 SDK from the Microsoft website.

Using the Windows SideShow Gadget Wizard

These instructions assume you are using Visual Studio 2008, but the steps for Visual Studio 2005 are similar.

To create a new Windows SideShow gadget project
  1. Open Visual Studio.

  2. On the File menu, point to New, and then click Project. The New Project dialog box opens.

  3. In the Project types pane, click Visual C# or Visual Basic.

  4. In the Templates pane, click SideShow Gadget.

  5. In the Name box, type a name for your gadget project.

  6. Click OK. The Windows SideShow gadget wizard dialog box opens.

  7. In the Gadget friendly name box, type the display name for your new gadget. This string will appear in Windows SideShow Control Panel.

  8. To add a property page to your new project, select the Create a property page check box.

  9. If you want the gadget to work only when the computer is on and available, select the Make this gadget online only check box.

  10. To generate the new gadget project, click OK.

About the Post-Build Events

You should know about a couple of post-build events that occur when building the gadget project the wizard generates.

A Windows SideShow gadget needs to be registered to be usable. The projects the wizard creates use the SideShow object model to enable you to register the gadget through a command-line option. For projects created using the wizard, this command-line option (-r) executes as a post-build event in Visual Studio. While this technique makes it easy to develop and test gadgets, you should not register gadgets on a user’s computer this way. Instead, your installer should register gadgets by using the Windows Installer Registry table. You can see the registration code in the function named Main in the GadgetEntry.cs file.

If the gadget you created includes a property page, the project includes a post-build event to register the gadget assembly by using the Regasm.exe tool with the /codebase option. This process enables Windows SideShow to discover and instantiate the property page class as a COM object. For this registration to work without issuing warnings, you must sign the gadget assembly. For information about assembly signing, see How to: Sign an Assembly (Visual Studio) on MSDN.

See Also