有没有通过VB程序读取数字信号的方法?
遥控器通过USB连接到pc。当有人按下遥控器上的按钮时,USB将捕获信号,VB程序将读取该信号。换句话说,当按下远程键时,VB程序应该能够感应到USB记录的信号。
请让我知道是否有任何API或其他机制在Visual Basic实现这一点。
您可以使用服务器作为存储来保存机器的按键
按下按钮的机器:
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
希望这对你有帮助!