GetDevicePowerState

[DllImport("Kernel32.dll", SetLastError = true)][return: MarshalAs(UnmanagedType.Bool)]
public static extern bool GetDevicePowerState(
   IntPtr hDevice,
   [MarshalAs(UnmanagedType.Bool)] out bool pfOn
);

Microsoft documentation: Link

Last updated