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