public PowerRequest(string simpleReason) { // Set up the diagnostic string. POWER_REQUEST_CONTEXT context; context.Version = POWER_REQUEST_CONTEXT_VERSION; context.Flags = POWER_REQUEST_CONTEXT_SIMPLE_STRING; context.SimpleReasonString = simpleReason; // Create the request and get a handle. powerRequestHandle = PowerCreateRequest(ref context); if (powerRequestHandle.IsInvalid) { throw new Win32Exception(); } }
private static extern bool PowerClearRequest( SafePowerRequestHandle hPowerRequest, PowerRequestType RequestType);