ISideShowEvents::DeviceRemoved Method
Notifies the Windows SideShow gadget that its association with a specific device has ended.
Declaration
[C++]
HRESULT DeviceRemoved(
ISideShowCapabilities *in_pIDevice
);
Parameters
in_pIDevice
[in] A pointer to an ISideShowCapabilities interface that describes the specified device that is no longer associated with the Windows SideShow gadget.
Return Values
HRESULT value |
Description |
S_OK |
Success, indicating that the Windows SideShow gadget acknowledges the removal of the specified device. |
Other HRESULT values |
The Windows SideShow gadget may return HRESULT values other than S_OK to communicate error conditions to the Windows SideShow platform. |
Remarks
A Windows SideShow gadget implements the ISideShowEvents interface, through which the Windows SideShow platform posts events to the gadget. The gadget uses the SetEventSink method of the ISideShowContentManager interface to provide a pointer to the ISideShowEvents interface through which events should be posted.
This event can be generated in two ways. First, when an associated device is physically disconnected, and second, when an associated device is disassociated with the Windows SideShow gadget as a result of user configuration within the Windows SideShow Control Panel.
Example
This example demonstrates one possible implementation of the ISideShowEvents::DeviceRemoved Method in the client-implemented ISideShowEvents interface. Other implementations are, of course, possible.
Gadgets that utilize the gadget manager utility should shut down their gadget to conserve system resources if, during a device remove event, the gadget detects there are no more associated devices available. Gadget-specific processing may be required, as illustrated by the following example.
[C++]
STDMETHODIMP CSideShowEvents::DeviceRemoved(ISideShowCapabilities* pCapabilities)
{
//
// Call an application-specific routine to process
// the removal of the device.
//
// If the gadget uses a StartCommand to have the
// Gadget Manager invoke it, the ProcessDeviceRemoval
// routine should check the number of remaining devices,
// and if it is 0, shut down the gadget.
//
ProcessDeviceRemoval(pCapabilities);
return S_OK;
}
Applies To
See Also
Concepts
ISideShowContentManager
ISideShowContentManager::SetEventSink Method
ISideShowEvents::DeviceAdded Method