Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Wednesday, August 12, 2009 1:06:12 AM(UTC)
JOO HYUN YOON

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
 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Wednesday, August 12, 2009 6:56:41 AM(UTC)

Adnan Ismail  
Guest

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)
JOO HYUN YOON

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)

Adnan Ismail  
Guest

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.

Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.073 seconds.