This topic and its replies were posted before the current version of LEADTOOLS was released and may no longer be applicable.
#1
Posted
:
Wednesday, August 12, 2009 1:06:12 AM(UTC)
Groups: Registered
Posts: 16
Hi,
I am using LTMM V.16 for capture application. (Vb.net Multimedia capture)
And I have one question about connection of device.
In the code, when I make device menu, we use a loop for checking usb device.
For i = 0 To count - 1
name = AxltmmCaptureCtrl1.VideoDevices.Item(i).FriendlyName
If (name = "My Device Name") Then
AxltmmCaptureCtrl1.VideoDevices.Item(i).Selected = True
DeviceName = AxltmmCaptureCtrl1.VideoDevices.Item(i).FriendlyName
Exit Sub
End If
Next
After that, the application can check my machine name and can run application.
I want to check disconnect status.
After running application, I checked new loop for using timer for checking device name and number of array.
But after event of machine disconnection, I can not get different name and array before event.
Therefore I can not check my status of machine.
It is my code sample. please let me know how to check machine connection.
Sub BuildDeviceMenu()
Dim count As Integer
Dim i As Integer
Dim name As String
count = AxltmmCaptureCtrl1.VideoDevices.Count
If (count > 0) Then
For i = 0 To count - 1
name = AxltmmCaptureCtrl1.VideoDevices.Item(i).FriendlyName
If (name = "My Device Name") Then
AxltmmCaptureCtrl1.VideoDevices.Item(i).Selected = True
DeviceName = AxltmmCaptureCtrl1.VideoDevices.Item(i).FriendlyName
Exit Sub
End If
Next
End If
VideoCheckTimer.Enabled = True
End Sub
Private Sub VideoCheckTimer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles VideoCheckTimer.Tick
Dim count As Integer
Dim k As Integer
Dim name As String
count = AxltmmCaptureCtrl1.VideoDevices.Count
If (count > 0) Then
For k = 0 To count - 1
name = AxltmmCaptureCtrl1.VideoDevices.Item(k).FriendlyName
Next
End If
name = AxltmmCaptureCtrl1.VideoDevices.Item(DeviceIndex).FriendlyName
If Not (DeviceName = name) Then
VideoCheckTimer.Enabled = False
If (MessageBox.Show("Fail to find USB device driver. Check the USB plug or the power of the USB set.", "SDP-860 Error", MessageBoxButtons.OK, _
MessageBoxIcon.Warning) = Windows.Forms.DialogResult.OK) Then
Me.Close()
End If
End If
End Sub
#2
Posted
:
Wednesday, August 12, 2009 6:56:41 AM(UTC)
Groups: Guests
Posts: 3,022
Was thanked: 2 time(s) in 2 post(s)
In your timer code, call the following function to rebuild the device collection:
AxltmmCaptureCtrl1.VideoDevices.Refresh()
When you disconnect one of the devices, this function will rebuild the list without it.
#3
Posted
:
Thursday, August 13, 2009 2:07:11 AM(UTC)
Groups: Registered
Posts: 16
Thank you for your answer,
But when i use AxltmmCaptureCtrl1.VideoDevices.Refresh(),
it rebuild device collection and reconnect device index.
I want to rebuild device collection without reconnect device(It cause screen flash by periods.)
#4
Posted
:
Thursday, August 13, 2009 7:07:36 AM(UTC)
Groups: Guests
Posts: 3,022
Was thanked: 2 time(s) in 2 post(s)
You can refresh the video devices in a different control. This way, it will not affect the used control and it can tell you if the number of devices has changed or not.
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.