2个回答
展开全部
部件中加入SysInfo控件,然后在窗体上放一个SysInfo控件,输入以下代码:
Private Sub SysInfo1_DeviceArrival(ByVal DeviceType As Long, ByVal DeviceID As Long, ByVal DeviceName As String, ByVal DeviceData As Long)
MsgBox "发现新的即插即用设备!"
End Sub
Private Sub SysInfo1_DeviceRemoveComplete(ByVal DeviceType As Long, ByVal DeviceID As Long, ByVal DeviceName As String, ByVal DeviceData As Long)
MsgBox "发现有设备被移除!"
End Sub
这种方法可以发现任何即插即用设备的插入与移除,不单单是针对USB端口的。
Private Sub SysInfo1_DeviceArrival(ByVal DeviceType As Long, ByVal DeviceID As Long, ByVal DeviceName As String, ByVal DeviceData As Long)
MsgBox "发现新的即插即用设备!"
End Sub
Private Sub SysInfo1_DeviceRemoveComplete(ByVal DeviceType As Long, ByVal DeviceID As Long, ByVal DeviceName As String, ByVal DeviceData As Long)
MsgBox "发现有设备被移除!"
End Sub
这种方法可以发现任何即插即用设备的插入与移除,不单单是针对USB端口的。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询