Share via


SideShowGadget.GetCapabilitiesForDevices Method

Returns an array of DeviceCapabilties objects; one for each Windows SideShow-compatible device connected to the gadget.

Namespace: Microsoft.SideShow
Assembly: Microsoft.SideShow (in microsoft.sideshow.dll)

Usage

Syntax

'Declaration
Public Function GetCapabilitiesForDevices As DeviceCapabilities()
public DeviceCapabilities[] GetCapabilitiesForDevices ()
public:
array<DeviceCapabilities^>^ GetCapabilitiesForDevices ()
public DeviceCapabilities[] GetCapabilitiesForDevices ()
public function GetCapabilitiesForDevices () : DeviceCapabilities[]

Return Value

A DeviceCapabilities array that reflects the capabilities of each Windows SideShow-compatible device connected to this gadget.

Example

The following example code shows how to display the number of connected Windows SideShow-compatible devices, each device’s ID, and some of the capabilities of the devices.

private static void SampleDeviceCapabilities()
{
    // Set the gadget's GUID.
    Guid gadgetId = new Guid("{0530B726-F6D5-4a66-900E-3C7673316F3B}");
    
    // Register the gadget.
    GadgetRegistration.Register(
        false,                           // Register gadget for current user only
        gadgetId,                        // Guid for the registry subkey
        ScfSideShowGadget.ScfEndpointId, // Endpoints registry value
        "Example SideShow gadget",       // FriendlyName registry value
        null,                            // StartCommand registry value
        null,                            // Icon registry value, this gadget will use the generic gadget icon.
        false,                           // OnlineOnly registry value
        GadgetCachePolicies.KeepNewest,  // CachePolicy registry value
        null);

    // Connected SideShow device capabilities.
    using (ScfSideShowGadget gadget = new ScfSideShowGadget(gadgetId))
    {
        // Display the number of connected SideShow devices.
        Console.WriteLine("Device count=" + gadget.GetDeviceCount());
        // Get the capabilities for each connected SideShow device.
        DeviceCapabilities[] caps = gadget.GetCapabilitiesForDevices();
        // Display the DeviceId, ScreenHeight, ScreenWidth, ColorDepth and SupportedImageFormats for each connected SideShow device.
        for (Int32 n = 0; n < caps.Length; n++)
        {
            Console.WriteLine("Device #{0} has ID of {1}", n, caps[n].GetDeviceId());
            Console.WriteLine("Device #{0} has a screen height of {1}", n, caps[n].GetScreenHeight());
            Console.WriteLine("Device #{0} has a screen width of {1}", n, caps[n].GetScreenWidth());
            Console.WriteLine("Device #{0} has a color depth of {1}", n, caps[n].GetColorDepth());
            Console.WriteLine("Device #{0} supports the following image formats: {1}", n, caps[n].GetSupportedImageFormats());
        }
    }
}

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Platforms

Development Platforms

Windows Vista Home Premium, Windows Vista Business, Windows Vista Enterprise, Windows Vista Ultimate

Target Platforms

Windows Vista Home Premium, Windows Vista Business, Windows Vista Enterprise, Windows Vista Ultimate

See Also

Reference

SideShowGadget Class
SideShowGadget Members
Microsoft.SideShow Namespace