Public Enum DevicePowerState As Integer
Unspecified = -1
FullPower = 0 'Full On: full power, full functionality
LowPower = 1 'Low Power On: fully functional at low power/performance
Standby = 2 'Standby: partially powered with automatic wake
Sleep = 3 'Sleep: partially powered with device initiated wake
Off = 4 'Off: unpowered
End Enum
Private Declare Function SetDevicePower Lib "coredll.dll" (ByVal deviceId As String, ByVal flags As Integer, ByVal state As DevicePowerState) As Integer
Private Declare Function DevicePowerNotify Lib "coredll.dll" (ByVal deviceId As String, ByVal state As DevicePowerState, ByVal flags As Integer) As Integer
Public Sub TurnRadioCardOn()
Dim ret1 As Integer
Dim ret2 As Integer
Try
ret1 = DevicePowerNotify("{98C5250D-C29A-4985-AE5F-AFE5367E5006}\" & gstrComputerName, DevicePowerState.FullPower, 1)
ret2 = SetDevicePower("{98C5250D-C29A-4985-AE5F-AFE5367E5006}\" & gstrComputerName, 1, DevicePowerState.FullPower)
MsgBox(ret1 & " " & ret2)
Application.DoEvents()
Catch f As Exception
MsgBox("TurnRadioCardOn " & Err.Number & ": " & Err.Description)
End Try
End Sub
Public Sub TurnRadioCardOff()
Dim ret1 As Integer
Dim ret2 As Integer
Try
ret1 = DevicePowerNotify("{98C5250D-C29A-4985-AE5F-AFE5367E5006}\" & gstrComputerName, DevicePowerState.Off, 1)
ret2 = SetDevicePower("{98C5250D-C29A-4985-AE5F-AFE5367E5006}\" & gstrComputerName, 1, DevicePowerState.Off)
MsgBox(ret1 & " " & ret2)
Application.DoEvents()
Catch f As Exception
MsgBox("TurnRadioCardOff " & Err.Number & ": " & Err.Description)
End Try
End Sub