GetCameraList
Top  Previous  Next

Description

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


Syntax


[VB]
Value=objActiveGige.GetCameraList()


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


Data Types
[VB]

Return value: Variant (Array of strings)


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 = ActiveGige1.GetCameraList
For
 i = 0 
To
 UBound(CamLst)
Combo1.AddItem (CamLst(i))
Next
Combo1.ListIndex = 0
ActiveGige1.Acquire = 
True
End Sub

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

VARIANT m_CamArray=m_ActiveGige.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_ActiveGige.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.