System.Gadget.SideShow.addImage method

[ The Windows Gadget Platform/Sidebar is available for use in the operating systems specified in the Requirements section. It may be altered or unavailable in subsequent versions. ]

Adds an image element to the SideShow device.

Syntax

System.Gadget.SideShow.addImage(
  intID,
  strFilename
)

Parameters

intID [in]

Integer that specifies the SideShow content ID.

strFilename [in]

String that specifies the UNC path with filename.

Return value

This method does not return a value.

Remarks

When calling addText and addImage repeatedly with the same ID, it is recommended that you call remove or removeAll prior to updating the content for a given ID.

Supported file types are .JPG, .GIF, and .PNG.

Verify that System.Gadget.SideShow.enabled returns true before using other System.Gadget.SideShow object members.

Examples

The following example demonstrates how to add an image to a SideShow gadget.

//
// sideshow.js - Contains all Windows SideShow specific code.
//

sideshow =
{
    imageIdUp: 50,
    imageIdEqual: 51,
    imageIdDown: 52,
    
    // --------------------------------------------------------------------
    // initialize() - Initialize the SideShow portion of the gadget.
    // --------------------------------------------------------------------
    initialize: function()
    {
        // Ensure SideShow is enabled for this machine.
        if (!System.Gadget.SideShow.enabled())
        {
            // If it is not available, return without initializing anything.
            return;
        }
        
        System.Gadget.SideShow.setFriendlyName("Stocks");
        sideshow.clearContent();

        // Add images.
        System.Gadget.SideShow.addImage(sideshow.imageIdUp, System.Gadget.path + "\\images\\up.gif");
        System.Gadget.SideShow.addImage(sideshow.imageIdEqual, System.Gadget.path + "\\images\\equal.gif");
        System.Gadget.SideShow.addImage(sideshow.imageIdDown, System.Gadget.path + "\\images\\down.gif");
    },
    
    // --------------------------------------------------------------------
    // clearContent() - Removes all content from the device and puts in default text.
    // --------------------------------------------------------------------
    clearContent: function()
    {
        // Remove all content from the device.
        System.Gadget.SideShow.removeAll();
        System.Gadget.SideShow.addText(0, "ServiceIsUnavailable");    
    }
}        

Requirements

Minimum supported client
Windows Vista [desktop apps only]
Minimum supported server
Windows Server 2008 [desktop apps only]
End of client support
Windows 7
End of server support
Windows Server 2008
IDL
Sidebar.idl
DLL
Sidebar.Exe (version 1.00 or later)

See also

System.Gadget.SideShow

Other Resources

Windows SideShow: MSDN

Windows SideShow: Windows Hardware Developer Central