I am new to python Ctypes, i use GetDevicePowerState
function I don't know how to input hDevice ?
https://learn.microsoft.com/zh-TW/windows/win32/api/winbase/nf-winbase-getdevicepowerstate
import ctypes as ct
from ctypes import wintypes as w
Kernel32 = ct.WinDLL('Kernel32')
Kernel32.GetDevicePowerState.argtypes = w.HANDLE,w.BOOLEAN
Kernel32.GetDevicePowerState.restype = w.BOOLEAN
hDevice = 'USB'
pfOn = True
result = Kernel32.GetDevicePowerState(hDevice,pfOn)
print(result)