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



Occurs when an error has caused an operation to abort.

Syntax

Visual Basic (Declaration) 
Public Event ErrorAbort As ErrorAbortEventHandler
Visual Basic (Usage)Copy Code
Dim instance As PlayCtrl
Dim handler As ErrorAbortEventHandler
 
AddHandler instance.ErrorAbort, handler
C# 
public event ErrorAbortEventHandler ErrorAbort
C++/CLI 
public:
event ErrorAbortEventHandler^ ErrorAbort

Example

Visual BasicCopy Code
Public _result As Boolean = False
      Public _form As PlayCtrlForm = New PlayCtrlForm()
      Public Sub ErrorAbortExample()
         ' reference the play control
         Dim playctrl As PlayCtrl = _form.PlayCtrl

         Dim inFile As String = Path.Combine(LEAD_VARS.MediaDir, "PlayCtrl_Source.avi")

         Try
            AddHandler playctrl.ErrorAbort, AddressOf ErrorAbort_Helper
            playctrl.SourceFile = inFile
            playctrl.Run()
         Catch cex As COMException
            If cex.ErrorCode = CInt(ErrorCode.VFW_S_VIDEO_NOT_RENDERED) Then
               _result = False
            End If
         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 ErrorAbort_Helper(ByVal sender As Object, ByVal e As ErrorAbortEventArgs)
         ' set result
         _result = True
      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 bool _result = false;
      public PlayCtrlForm _form = new PlayCtrlForm();
      public void ErrorAbortExample()
      {
         // reference the play control
         PlayCtrl playctrl = _form.PlayCtrl;

         string inFile =Path.Combine(LEAD_VARS.MediaDir,"PlayCtrl_Source.avi");

         try
         {
            playctrl.ErrorAbort += new ErrorAbortEventHandler(ErrorAbort_Helper);
            playctrl.SourceFile = inFile;
            playctrl.Run();
         }
         catch (COMException cex)
         {
            if (cex.ErrorCode == (int)ErrorCode.VFW_S_VIDEO_NOT_RENDERED)
               _result = false;
         }
         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 ErrorAbort_Helper(object sender, ErrorAbortEventArgs e)
      {
         // set result
         _result = true;
      }

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

Remarks

The event handler is passed an ErrorAbortEventArgs object containing the related error code. For more information, refer to the Error Codes.

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

Reference

PlayCtrl Class
PlayCtrl Members