PDA

View Full Version : Auto focus



fatman45
November 19, 2012, 23:47:09
Hello,

I'm using the DFK 72AUC02-F camera with the ActiveX control in a VBA application. There is a button on the dialog shown when the ShowPropertyDialog method is invoked that, when clicked, will cause the camera to auto focus. I would like to put a button like this directly on to my VBA form. However, I can't seem to find a method like this in the ActiveX documentation. I searched this forum but all I found was a suggestion to call a DirectShow method. I'm not sure what that means. Can you provide me with VB sample code to invoke the camera's auto focus? Thank you!

Regards,

Ron Hinds

Stefan Geissler
November 20, 2012, 09:04:10
Hi Ron

Using the autofocus can be done simply by using the VCDProperties. First of all, add the VCDPropertyID.BAS module to your VB project.
Then insert the button event handler:

Private Sub btnFocus_Click()
Dim Focus As VCDButtonProperty

Set Focus = ICImagingControl1.VCDPropertyItems.FindInterface(V CDID_Focus + ":" + _
VCDElement_OnePush + ":" + _
VCDInterface_Button)

If Not Focus Is Nothing Then
Focus.Push
Else
MsgBox "Autofocus not available. Correct camera installed and IC Imaging Control 3.1 or higher installed?"
End If
End Sub


Using VCDProperties in VB6 is shown here:
http://www.imagingcontrol.com/en_US/support/documentation/activex/tech_VCDProperties.htm
This little samples shows how to use VCDProperties and add the VCDPropertyID.BAS Module
http://www.imagingcontrol.com/en_US/support/documentation/activex/AdjustImageSettings.htm

Using the VCDPropertyInspector, which is installed with IC Imaging Control, you can see the VCDID, VCDElement and VCDInterface needed for a property.

In case VBA does not allow the use of modules, you can use the strings definded in the VCDPropertyID.BAS module directly.

However, VB6 is outdated. You should switch to .NET. I guess, there is something similar to VBA.

fatman45
November 20, 2012, 17:26:34
Thanks Stefan! Modules can be added to VBA projects, so that shouldn't be a problem. Or I should say I can cut and paste the code into a VBA module.

VBA is used for automating Microsoft Office applications; in this case, the Access database application. There is no equivalent to .NET as a replacement for VBA, at least not in Office 2010 - I haven't tried the latest version of Office yet.