终于能震动了
试验了好久 终于能震动了 不过是用 vb.net 写的 在微软的网站上竟然说 wm5 的ppc 机器不支持
添加个类 名字为LED
Public Class LED
Private Structure NLED_SETTINGS_INFO
Public LedNum As UInt32
Public OffOnBlink As UInt32
Public TotalCycleTime As Integer
Public OnTime As Integer
Public OffTime As Integer
Public MetaCycleOn As Integer
Public MetaCycleOff As Integer
End Structure
Private Structure NLED_COUNT_INFO
Public cLeds As Integer
End Structure
Private Const NLED_COUNT_INFO_ID = 0
Private Const NLED_SETTINGS_INFO_ID = 2
Private Declare Function NLedGetDeviceInfo Lib "coredll.dll" (ByVal nID As Integer, ByRef pOutput As NLED_COUNT_INFO) As Boolean
Private Declare Function NLedSetDevice Lib "coredll.dll" (ByVal nID As Integer, ByRef pOutput As NLED_SETTINGS_INFO) As Boolean
Public Enum Status
OFF
[ON]
BLINK
End Enum
Public Function GetLedCount() As Integer
Dim nci As NLED_COUNT_INFO
Dim wCount As Integer = 0
If NLedGetDeviceInfo(NLED_COUNT_INFO_ID, nci) Then
wCount = CInt(nci.cLeds)
End If
Return wCount
End Function
Public Sub SetLedStatus(ByVal wLed As Integer, ByVal wStatus As Status)
Dim nsi As NLED_SETTINGS_INFO
nsi.LedNum = System.Convert.ToUInt32(wLed)
nsi.OffOnBlink = System.Convert.ToUInt32(wStatus)
NLedSetDevice(NLED_SETTINGS_INFO_ID, nsi)
End Sub
End Class
先定义引用类
Public LED As New LED
测试
Me.Text = LED.GetLedCount() '得到机器所支持的数量
测试震动 震动为1
Dim wLed As Integer = CInt(InputBox("Led", , "0" )
Dim wStatus As Integer = CInt(InputBox("Status", , "1" )
LED.SetLedStatus(wLed, wStatus)
停止震动 status 设置为0
试验了好久 终于能震动了 不过是用 vb.net 写的 在微软的网站上竟然说 wm5 的ppc 机器不支持
添加个类 名字为LED
Public Class LED
Private Structure NLED_SETTINGS_INFO
Public LedNum As UInt32
Public OffOnBlink As UInt32
Public TotalCycleTime As Integer
Public OnTime As Integer
Public OffTime As Integer
Public MetaCycleOn As Integer
Public MetaCycleOff As Integer
End Structure
Private Structure NLED_COUNT_INFO
Public cLeds As Integer
End Structure
Private Const NLED_COUNT_INFO_ID = 0
Private Const NLED_SETTINGS_INFO_ID = 2
Private Declare Function NLedGetDeviceInfo Lib "coredll.dll" (ByVal nID As Integer, ByRef pOutput As NLED_COUNT_INFO) As Boolean
Private Declare Function NLedSetDevice Lib "coredll.dll" (ByVal nID As Integer, ByRef pOutput As NLED_SETTINGS_INFO) As Boolean
Public Enum Status
OFF
[ON]
BLINK
End Enum
Public Function GetLedCount() As Integer
Dim nci As NLED_COUNT_INFO
Dim wCount As Integer = 0
If NLedGetDeviceInfo(NLED_COUNT_INFO_ID, nci) Then
wCount = CInt(nci.cLeds)
End If
Return wCount
End Function
Public Sub SetLedStatus(ByVal wLed As Integer, ByVal wStatus As Status)
Dim nsi As NLED_SETTINGS_INFO
nsi.LedNum = System.Convert.ToUInt32(wLed)
nsi.OffOnBlink = System.Convert.ToUInt32(wStatus)
NLedSetDevice(NLED_SETTINGS_INFO_ID, nsi)
End Sub
End Class
先定义引用类
Public LED As New LED
测试
Me.Text = LED.GetLedCount() '得到机器所支持的数量
测试震动 震动为1
Dim wLed As Integer = CInt(InputBox("Led", , "0" )
Dim wStatus As Integer = CInt(InputBox("Status", , "1" )
LED.SetLedStatus(wLed, wStatus)
停止震动 status 设置为0