PDA

View Full Version : How to Enable/Disable Strobe



ronnie.b
November 25, 2008, 09:44:49
Hello,
is it posible to Enable and Disable the Strobe Signal over IC-ActiveX-Control??

Ronnie

Stefan Geissler
November 25, 2008, 10:06:14
Ronnie,

yes, it is possible. In the "samples\vb6" directory in your IC Imaging Control installation directory is a sample in the "strobe" directory.


Option Explicit

' Add the VCDSimpleProperty to handle all new properties in a simple way.
Private VCDProp As VCDSimpleProperty

'
' CheckForStrobe
'
' This sub checks, whether stobe is available. If strobe is available,
' the strobe checkbox "cmdStrobe" will be enabled and set to the current
' state of the strobe property.
'
Private Sub CheckForStrobe()
With ICImagingControl1
If .DeviceValid = True Then
If Not VCDProp.Available(VCDID_Strobe) Then
chkStrobe.Value = 0
chkStrobe.Enabled = False
Else
chkStrobe.Enabled = True
If VCDProp.Switch(VCDID_Strobe) = True Then
chkStrobe.Value = 1
Else
chkStrobe.Value = 0
End If
End If
End If
End With
End Sub


Private Sub chkStrobe_Click()
If chkStrobe.Value = 1 Then
VCDProp.Switch(VCDID_Strobe) = True
Else
VCDProp.Switch(VCDID_Strobe) = False
End If

End Sub

'
' cmdDevice_Click
'
' Show the IC Imaging Control device selection dialog. If a device has been
' opened, the current device and its state is saved to a file, so it can be
' opened automatically at next program start.
'
Private Sub cmdDevice_Click()
With ICImagingControl1
If .LiveVideoRunning Then
.LiveStop
End If

.ShowDeviceSettingsDialog

If .DeviceValid Then
.SaveDeviceStateToFile "device.xml"
cmdStart.Enabled = True
cmdSettings.Enabled = True
' Initialize the VCDProp class to access the properties of our ICImagingControl
' object
Set VCDProp = GetSimplePropertyContainer(.VCDPropertyItems)
CheckForStrobe
Else
cmdStart.Enabled = False
cmdSettings.Enabled = False
chkStrobe.Enabled = False
End If
End With
End Sub

'
' cmdSettings_Click
'
' Show the image property dialog of IC Imaging Control.

Private Sub cmdSettings_Click()
With ICImagingControl1
If .DeviceValid = True Then
.ShowPropertyDialog
.SaveDeviceStateToFile "device.xml"
End If
End With
End Sub

'
' cmdStart_Click
'
' Start and stop the live video.
'
Private Sub cmdStart_Click()
With ICImagingControl1
If .DeviceValid = True Then
If .LiveVideoRunning Then
.LiveStop
cmdStart.Caption = "Start"
Else
.LiveStart
cmdStart.Caption = "Stop"
End If
End If
End With
End Sub

Private Sub Form_Load()
With ICImagingControl1

On Error Resume Next
' Try to restore the last used video capture device.
.LoadDeviceStateFromFile "device.xml", True
If .DeviceValid Then
cmdStart.Enabled = True
cmdSettings.Enabled = True
chkStrobe.Enabled = True
' Initialize the VCDProp class to access the properties of our ICImagingControl
' object
Set VCDProp = GetSimplePropertyContainer(.VCDPropertyItems)
CheckForStrobe
Else
cmdStart.Enabled = False
cmdSettings.Enabled = False
chkStrobe.Enabled = False
End If
End With
End Sub

ronnie.b
November 26, 2008, 16:44:19
Hi,
and how to do in VC++ 6.0 (+ IC ActiveX) ???

Stefan Geissler
November 27, 2008, 09:21:37
Hi,

better you do not do this in VC++ 6.0 with the ActiveX control, because the ActiveX importer, that generates the wrapper class does not work correctly. If you program in C++, please use the IC Classlibrary, even if this looks more complicated on the first view.

For strobe is a C++ sample available too.

ronnie.b
November 28, 2008, 11:43:47
Hello,
I tried to use IC Classlib but get Exceptions and Memory Leaks. (also i just call DShowLib::InitLibrary)

So i decide to use ActiveX-Control and I think It works well.

Ronnie

Stefan Geissler
November 28, 2008, 12:13:09
The memory leaks are caused, because you seem not to call ExitLibrary() at the end of your program.

Since I do not know the exceptions you mention, I can not help you with this issue.

At least, the last version of IC I used in C++ was 1.3.

You would help me, if you provide your sample to me.

You may contact me at http://www.imagingcontrol.com/en_US/support/case/