VB数字信号处理

时间:2014-06-12 13:51:31

标签: vb.net vb6

有没有办法通过VB程序读取数字信号?

遥控器通过USB连接到电脑。当有人按下遥控器上的按钮时,USB将捕获VB程序将读取的信号。换句话说,当按下遥控键时,VB程序应该能够感应USB记录的信号。

如果Visual Basic中有任何API或其他机制来实现此目的,请告诉我。

1 个答案:

答案 0 :(得分:0)

您可以使用服务器作为存储来保存到机器的按键。

按下按钮上的机器:

Public Class Form1
    Private Sub Form1_KeyPress(sender As Object, e As KeyPressEventArgs) Handles From1.KeyPress
        Dim FS As New IO.FileStream("file", IO.Filemode.Create)
        Dim SW As New IO.StreamWriter(FS)
        SW.Write(e.keyCode)
        SW.Close()
        FS.Close()
        My.Computer.Network.UploadFile("file", "domain.com/file", "ftpusername", "ftppassword")
    End Sub
End Class

在其他机器上:

Public Class Form1
    Private Timer1 as New Timer
    Private Sub Form1_Load(sender As Object, e As Eventargs) Handles MyBase.Load
        Timer1.Interval = 1
        Timer1.Start()
    End Sub

    Private Sub Timer1_Tick(sender As Object, e As Eventargs)
        My.Computer.Network.DownloadFile("domain.com/file", "file", "ftpusername", "ftppassword")
        Dim KeyCode = IO.File.ReadAllText("file");
        'Do Stuff...
    End Sub
End Class

希望这有帮助!