SetDevicePower
This function sets the device power state for a device.
DWORD SetDevicePower(
PVOID pvDevice,
DWORD dwDeviceFlags,
CEDEVICE_POWER_STATE DeviceState
);
Parameters
- pvDevice
[in] Specifies the device. Must be a valid LPWSTR device name, for example, "COM1:". This parameter is interpreted according to dwDeviceFlags. - dwDeviceFlags
[in] Set to POWER_NAME to specify the name of the device that is requesting the power request. - DeviceState
[in] Specifies the desired device power state.
Return Values
- ERROR_SUCCESS
Device found and device power state updated correctly. - ERROR_FILE_NOT_FOUND
Device not found. - ERROR_WRITE_FAULT
Attempt to update the device power failed. - ERROR_INVALID_PARAMETER
Invalid device ID, flag, or dwState value.
Remarks
When SetDevicePower is called, qualify the name of your device with an associated class. For example, {8DD679CE-8AB4-43c8-A14A-EA4963FAA715}\DSK1: refers to a power-managed block device called DSK1. If no class qualification is present, the generic power-manageable class {A32942B7-920C-486b-B0E6-92A702A99B35} is assumed.
Applications should avoid using the API because it greatly restricts device power self-management. They should use the SetPowerRequirement call instead. Set the device power state to PwrDeviceUnspecified to allow normal power management to resume.
Requirements
OS Versions: Windows CE .NET 4.0 and later.
Header: Pm.h.
Link Library: Coredll.lib.
See Also
Last updated on Tuesday, May 18, 2004
© 1992-2003 Microsoft Corporation. All rights reserved.