vb.net WM5 震动

终于能震动了

试验了好久 终于能震动了 不过是用 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

 
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值