ISideShowCapabilitiesCollection::GetAt Method
Enables the gadget to retrieve the ISideShowCapabilities interface at a specified index.
Declaration
[C++]
HRESULT GetAt(
[in] DWORD in_pdwIndex,
[out] ISideShowCapabilities ** out_ppDevice
);
Parameters
in_ pdwIndex
[in] A DWORD value that specifies the index of the device for which the ISideShowCapabilities objects are to be retrieved. The index is zero-based and sequential.
out_ppDevice
[out] A pointer to an interface pointer to the ISideShowCapabilities interface of the specified device.
Return Values
Possible values include, but are not limited to, those in the following table.
HRESULT value |
Description |
S_OK |
Success, indicating that the requested capabilities have been returned. |
E_INVALIDARG |
The index passed in is invalid. |
Remarks
You must call Release on the ISideShowCapabilities interface that is returned by this method.
Example
This example demonstrates how to retrieve the ISideShowCapabilities interface for each associated device.
[C++]
HRESULT hr;
ISideShowCapabilitiesCollection* pICapabilitiesCollection = NULL;
//
// Call GetDeviceCapabilities using the previously established pointer
// to the ContentManager object and check for failures.
// If successful, this call will return a pointer
// to an ISideShowCapabilitiesCollection interface.
//
hr = pISideShowContentManager->GetDeviceCapabilities(&pICapabilitiesCollection);
if (SUCCEEDED(hr) && NULL != pICapabilitiesCollection)
{
DWORD NumDevices = 0;
ISideShowCapabilities* pIDeviceCapabilities = NULL;
hr = pICapabilitiesCollection->GetCount(&NumDevices);
if (SUCCEEDED(hr) && NumDevices != 0)
{
for (DWORD Index = 0; Index < NumDevices; ++Index)
{
hr = pICapabilitiesCollection->GetAt(Index, &pIDeviceCapabilities);
if (SUCCEEDED(hr) && NULL != pIDeviceCapabilities)
{
WCHAR DeviceIdentifier[MAX_PATH];
unsigned short ScreenWidth;
unsigned short ScreenHeight;
//
// Call a routine that will retrieve several individual
// device capabilities. This routine will call
// GetCapability once for each of the capabilities it
// is meant to retrieve.
//
GetDeviceCapabilities(pIDeviceCapabilities,
DeviceIdentifier,
MAX_PATH,
&ScreenHeight,
&ScreenWidth);
//
// Call an application-specific routine to do something
// with the retrieved capabilities.
//
StoreDeviceCapabilities(DeviceIdentifier,
ScreenHeight,
ScreenWidth);
//
// Release the ISideShowCapabilities interface pointer.
//
pIDeviceCapabilities->Release();
pIDeviceCapabilities = NULL;
}
}
}
//
// Release the ISideShowCapabilitiesCollection interface pointer.
//
pICapabilitiesCollection->Release();
pICapabilitiesCollection = NULL;
}
else
{
//
// Handling of failures will be application-specific.
//
HandleFailure("GetDeviceCapabilities", hr);
}