Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Windows Vista SideShow Gadgets: Little Apps, Big Impact : Page 3

Vista's SideShow feature supports auxiliary screen devices that can run applications even when the main computer is turned off, letting users read news, play games, or check their email without powering up the main computer.


advertisement
Building the Example Gadget
Using Visual Studio 2005, create a new Windows application and name it RSSGadget.

Add a reference to the Microsoft.SideShow.dll file so you can access the APIs to send information to a SideShow device.

 
Figure 11. Simple Test Form: The figure shows how to populat the default Form1 with three Button controls.
Populate the default Form1 with three Button controls as shown in Figure 11.

Switch to the code-behind of Form1 and import the following namespaces:

Imports Microsoft.SideShow Imports Microsoft.SideShow.SimpleContentFormat

To install a SideShow gadget on a computer, you need to obtain a GUID. You can obtain one from . http://kruithof.xs4all.nl/uuid/uuidgen. After you have done that, declare a member variable to store the GUID:

Public Class Form1 '---You can get a GUID from http://kruithof.xs4all.nl/uuid/uuidgen--- Private _GadgetID As Guid = _ New Guid("c1c2c0e0-b277-11db-abbd-0800200c9a66")

Double-click on the Register Gadget button and code it as follows:



Private Sub btnRegister_Click( _ ByVal sender As System.Object, _ ByVal e As System.EventArgs) _ Handles btnRegister.Click '---register the gadget--- GadgetRegistration.Register( _ False, _ _GadgetID, _ ScfSideShowGadget.ScfEndpointId, _ "RSS Aggregator Gadget", _ Nothing, _ Nothing, _ False, _ GadgetCachePolicies.KeepNewest, _ Nothing) End Sub

You use the shared GadgetRegistration class to register or unregister a SideShow gadget. The parameters for the Register() method are:

Public Shared Sub Register( _ ByVal registerForAllUsers As Boolean, _ ByVal gadgetId As System.Guid, _ ByVal endpointId As System.Guid, _ ByVal friendlyName As String, _ ByVal startCmd As String, _ ByVal iconPathNameAndResourceId As String, _ ByVal onlineOnly As Boolean, _ ByVal policy As Microsoft.SideShow.GadgetCachePolicies, _ ByVal propertyPage As System.Nullable(Of System.Guid))

Press F5 to test the application and click on the Register Gadget button. A tooltip will appear in the System Tray to inform you that a SideShow gadget has been installed (see Figure 12).

 
Figure 12. Gadget Notification Tooltip: After installing a SideShow gadget, you'll see a Tooltip indicating that the SideShow gadget has been installed.
 
Figure 13. Viewing the GUID in the Registry: From this RegEdit screen capture, you can see where Windows stores the GUID you chose in the registry.
Windows stores the GUID that you used in the Registry in the location shown in Figure 13.

If you now refresh the Windows SideShow page in Control Panel, you will see that the gadget is installed and appears in the gadget list. In this case, send the gadget output to the SideShow Simulator by ticking the checkbox under the Windows SideShow Simulator column (see Figure 14).

 
Figure 14. Sending Gadget Output to the simulator: Check the checkbox under the Windows SideShow Simulator column to send the gadget output to the simulator.
 
Figure 15. Live Gadget: The figure shows the RSS Agrgegator gadget running in the simulator.
The gadget will now appear in the SideShow Simulator (see Figure 15).

To unregister the SideShow gadget from your computer, code the Unregister Gadget button as follows:

Private Sub btnUnregister_Click( _ ByVal sender As System.Object, _ ByVal e As System.EventArgs) _ Handles btnUnregister.Click '---unregister the gadget--- GadgetRegistration.Unregister(False, _GadgetID) End Sub

The Unregister() method has the following parameters:

Public Shared Sub Unregister( _ ByVal registerForAllUsers As Boolean, _ ByVal gadgetId As System.Guid)

Author's Note: Alternatively, to unregister a SideShow gadget, you can also delete the key directly from the Registry.



Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap