|
Using ActiveGige API at runtime
|
|
| #include <comdef.h>
|
| #include <atlbase.h>
|
| #include <atlconv.h>
|
| #include "ActiveGige.h"
|
|
|
| IActiveGige *pActiveGige;
|
| HRESULT hr = CoInitialize(0);
|
| if (hr==S_OK)
|
| {
|
| hr = CoCreateInstance(CLSID_ActiveGige, NULL, CLSCTX_INPROC_SERVER, IID_IActiveGige, (void**) &pActiveGige);
|
| }
|
|
|
| hr = pActiveGige->put_Camera(0); // selecting camera #0
|
| hr = pActiveGige->Grab(); // grabbing a frame
|
| hr = pActiveGige->SaveImage( OLESTR("frame1.jpg") ); //saving a frame as jpg file
|
| Dim WithEvents AG As ActiveGige
|
| Set AG = New ActiveGige
|
|
|
| CameraList=AG.GetCameraList 'retreiving the list of names of connected cameras
|
| AG.Camera=0 'selecting camera #0
|
| AG.SetFeature "GainRaw", 150 'setting Gain value
|
| AG.Acquire=True 'initiating the acquisition
|
| Private Sub AG_FrameAcquired()
|
| End Sub
|
| Set AG = Nothing
|
|
|
| Dim WithEvents AG As ACTIVEGIGELib.ActiveGige
|
| AG = New ACTIVEGIGELib.ActiveGige
|
|
|
| Dim CamLst As Object
|
| Dim i As Integer
|
| CamLst = AG.GetCameraList 'retrieving camera list
|
| ......
|
| AG.Camera = 0 |
|
| AG.Acquire = True
|
|
|
| Private Sub AG_FrameAcquired() Handles AG.FrameAcquired
|
| End Sub
|
|
|
| AG = Nothing
|
|
|
|
|
| ACTIVEGIGELib.ActiveGige AG;
|
| AG = new ACTIVEGIGELib.ActiveGige();
|
|
|
| AG.Camera = 0
|
| AG.Acquire=true; 'starting automatic acquisition
|
| AG.ShowProperties (true, 0); 'displaying buit-in property pages
|
|
|
|
|