GetCameraList
Top  Previous  Next

Description

Returns the array of strings containing the names of GenTL compatible devices connected to the system. The cameras are listed in the alphabetical order with each string of the array containing "interface: mufacturer model, device ID" (e.g. "1394: AVT Guppy F044C, DEV_0xA47010F0770C0").


Syntax


[VB]
Value=objActiveGeni.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 = ActiveGeni1.GetCameraList
For
 i = 0 
To
 UBound(CamLst)
Combo1.AddItem (CamLst(i))
Next
Combo1.ListIndex = 0
ActiveGeni1.Acquire = 
True
End Sub

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

VARIANT m_CamArray=m_ActiveGeni.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_ActiveGeni.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.