Saves a snapshot from the running stream to a file as a device-independent bitmap(DIB).
fileName
A string that represents the filename to save the DIB to.
timeOut
The timeout period in milliseconds. This method fails if it is not able to take the DIB in the specified time. Use -1 to wait infinitely until a DIB is snapped.
Saves a snapshot, as a DIB, from the running stream to the specified filename. This method will not return until the specified timeout occurs or the DIB is snapped.
using Leadtools;using Leadtools.MediaFoundation;using LeadtoolsMediaFoundationExamples.Fixtures;public CaptureCtrlForm _form = new CaptureCtrlForm();public CaptureCtrl _capturectrl = null;public bool _result = false;string _dibFile = Path.Combine(LEAD_VARS.MediaDir, "CaptureCtrl_SaveStillDIB.dib");public void SaveStillDIBExample(){// reference the capture control_capturectrl = _form.CaptureCtrl;try{// select a video capture deviceif (_capturectrl.VideoDevices["USB"] == null)throw new Exception("No USB video device available");_capturectrl.VideoDevices["USB"].Selected = true;// start the capture_capturectrl.StartCapture(CaptureMode.Still);// save the still DIB to a file_capturectrl.SaveStillDIB(_dibFile, -1);// stop the capture_capturectrl.StopCapture();// check for the capture file and set the resultif (File.Exists(Path.Combine(Directory.GetCurrentDirectory(), _dibFile)))_result = true;}catch (Exception){_result = false;}}static class LEAD_VARS{public const string MediaDir = @"C:\Program Files (x86)\LEAD Technologies\LEADTOOLS 19\Media";}
Imports LeadtoolsImports Leadtools.MediaFoundationImports LeadtoolsMediaFoundationExamples.FixturesPublic _form As New CaptureCtrlForm()Public _capturectrl As CaptureCtrl = NothingPublic _result As Boolean = FalsePrivate _dibFile As String = Path.Combine(LEAD_VARS.MediaDir, "CaptureCtrl_SaveStillDIB.dib")Public Sub SaveStillDIBExample()' reference the capture control_capturectrl = _form.CaptureCtrlTry' select a video capture deviceIf _capturectrl.VideoDevices("USB") Is Nothing ThenThrow New Exception("No USB video device available")End If_capturectrl.VideoDevices("USB").Selected = True' start the capture_capturectrl.StartCapture(CaptureMode.Still)' save the still DIB to a file_capturectrl.SaveStillDIB(_dibFile, -1)' stop the capture_capturectrl.StopCapture()' check for the capture file and set the resultIf File.Exists(Path.Combine(Directory.GetCurrentDirectory(), _dibFile)) Then_result = TrueEnd IfCatch generatedExceptionName As Exception_result = FalseEnd TryEnd SubPublic NotInheritable Class LEAD_VARSPublic Const MediaDir As String = "C:\Program Files (x86)\LEAD Technologies\LEADTOOLS 19\Media"End Class
Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET
