LEADTOOLS Multimedia (Leadtools.Multimedia assembly) Send comments on this topic. | Back to Introduction | Help Version 17.0.3.22
SaveStillDIB Method
See Also 
Leadtools.Multimedia Namespace > PlayCtrl Class : SaveStillDIB Method



fileName
A string that represents the name to use when saving the snapshot.
timeOut
The timeout period, in milliseconds. This method will fail if it was not able to take a DIB in the specified time. Use -1 to wait indefinitely until a DIB is snapped.
fileName
A string that represents the name to use when saving the snapshot.
timeOut
The timeout period, in milliseconds. This method will fail if it was not able to take a DIB in the specified time. Use -1 to wait indefinitely until a DIB is snapped.
Saves a snapshot from the running stream to a file as a Device Independent Bitmap (DIB).

Syntax

Visual Basic (Declaration) 
Public Overridable Sub SaveStillDIB( _
   ByVal fileName As String, _
   ByVal timeOut As Integer _
) 
Visual Basic (Usage)Copy Code
Dim instance As PlayCtrl
Dim fileName As String
Dim timeOut As Integer
 
instance.SaveStillDIB(fileName, timeOut)
C# 
public virtual void SaveStillDIB( 
   string fileName,
   int timeOut
)
C++/CLI 
public:
virtual void SaveStillDIB( 
   String^ fileName,
   int timeOut
) 

Parameters

fileName
A string that represents the name to use when saving the snapshot.
timeOut
The timeout period, in milliseconds. This method will fail if it was not able to take a DIB in the specified time. Use -1 to wait indefinitely until a DIB is snapped.

Example

Visual BasicCopy Code
Public _form As PlayCtrlForm = New PlayCtrlForm()
      Public _playctrl As PlayCtrl = Nothing
      Public _result As Boolean = False
      Private _inFile As String = Path.Combine(LEAD_VARS.MediaDir, "PlayCtrl_Source.avi")
      Private _outFile As String = Path.Combine(LEAD_VARS.MediaDir, "PlayCtrl_SaveStillDIB.dib")

      Public Sub SaveStillDIBExample()
         ' reference the play control
         _playctrl = _form.PlayCtrl

         Try
            ' set a timer on the form to make the still DIB
            _form.TestTimer.Interval = 5000
            AddHandler _form.TestTimer.Tick, AddressOf SaveStillDIB_Helper

            ' set the source and target files
            _playctrl.SourceFile = _inFile

            ' now start the test timer for the still DIB capture
            _form.TestTimer.Start()
         Catch e1 As Exception
            _result = False
         End Try

         ' we'll loop on the state and pump messages for this example.
         ' but you should not need to if running from a Windows Forms application.
         Do While _playctrl.State = PlayState.Running
            Application.DoEvents()
         Loop
      End Sub

      Public Sub SaveStillDIB_Helper(ByVal sender As Object, ByVal e As EventArgs)
         ' cancel the timer
         _form.TestTimer.Stop()

         ' save the still DIB to a file
         _playctrl.SaveStillDIB(_outFile, -1)

         ' check for the capture file and set the result
         If File.Exists(Path.Combine(Directory.GetCurrentDirectory(), _outFile)) Then
            _result = True
         End If

         ' stop playback
         _playctrl.Stop()
      End Sub

Public NotInheritable Class LEAD_VARS
   Public Const MediaDir As String = "C:\Program Files (x86)\LEAD Technologies\LEADTOOLS 17\Media"
End Class
C#Copy Code
public PlayCtrlForm _form = new PlayCtrlForm();
      public PlayCtrl _playctrl = null;
      public bool _result = false;
      string _inFile =Path.Combine(LEAD_VARS.MediaDir,"PlayCtrl_Source.avi");
      string _outFile =Path.Combine(LEAD_VARS.MediaDir,"PlayCtrl_SaveStillDIB.dib");

      public void SaveStillDIBExample()
      {
         // reference the play control
         _playctrl = _form.PlayCtrl;

         try
         {
            // set a timer on the form to make the still DIB
            _form.TestTimer.Interval = 5000;
            _form.TestTimer.Tick += new EventHandler(SaveStillDIB_Helper);

            // set the source and target files
            _playctrl.SourceFile = _inFile;

            // now start the test timer for the still DIB capture
            _form.TestTimer.Start();
         }
         catch (Exception)
         {
            _result = false;
         }

         // we'll loop on the state and pump messages for this example.
         // but you should not need to if running from a Windows Forms application.
         while (_playctrl.State == PlayState.Running)
            Application.DoEvents();
      }

      public void SaveStillDIB_Helper(object sender, EventArgs e)
      {
         // cancel the timer
         _form.TestTimer.Stop();

         // save the still DIB to a file
         _playctrl.SaveStillDIB(_outFile, -1);

         // check for the capture file and set the result
         if (File.Exists(Path.Combine(Directory.GetCurrentDirectory(), _outFile)))
            _result = true;

         // stop playback
         _playctrl.Stop();
      }

static class LEAD_VARS
{
   public const string MediaDir = @"C:\Program Files (x86)\LEAD Technologies\LEADTOOLS 17\Media";
}

Remarks

Saves a snapshot from the running stream to a file. The file is saved as a DIB using the specified filename and timeout period. This method blocks (does not return) until the timeout occurs or the DIB is snapped.

Requirements

Target Platforms: Microsoft .NET Framework 2.0, Windows 2000, Windows XP, Windows Server 2003 family, Windows Server 2008 family, Windows Vista, Windows 7

See Also