GetCameraList
Top  Previous  Next

Description

Returns the array of strings containing the names of USB3 Vision™ cameras connected to the system. The cameras are listed in the alphabetical order "model + serial number".


Syntax


[VB]
Value=objActiveUSB.GetCameraList()


[C/C++]
HRESULT GetCameraList( VARIANT* pList );


Data Types
[VB]

Return value: Variant (SAFEARRAY)


Parameters
[C/C++]

pList [out,retval]  
Pointer to the SAFEARRAY containing camera names  


Return Values


S_OK  
Success  
E_FAIL  
Failure.  


Example


This VB example initializes a combo box with camera names and uses it to switch between the cameras:

Private Sub
 Form_Load()
CamLst = ActiveUSB1.GetCameraList
For
 i = 0 
To
 UBound(CamLst)
Combo1.AddItem (CamLst(i))
Next
Combo1.ListIndex = 0
ActiveUSB1.Acquire = 
True
End Sub

Private Sub
 Combo1_Click()
ActiveUSB1.Camera = Combo1.ListIndex
End Sub
 
This MFC example fills out a combo box with camera names:

VARIANT m_CamArray=m_ActiveUSB.GetCameraList();
SAFEARRAY *pArray=m_CamArray.parray;
UINT nCam=pArray->rgsabound[0].cElements;

CString strCamera;
CComboBox *pCamera=(CComboBox*)GetDlgItem(IDC_CAMERA);
for(UINT i=0;i<nCam;i++)
{
      CString str; str.Format("Camera %d",i);
      pCamera->AddString(str);
}
int iCam=m_ActiveUSB.GetCamera();
pCamera->SetCurSel(iCam);


SafeArrayDestroy(pArray);



Remarks


The index of an element in the camera list can be used as an argument of the Camera property to select a specific camera.

Note that in C/C++ applications it is required to call SafeArrayDestroy() to delete the SAFEARRAY returned by GetCameraList.