Imports Leadtools
Imports Leadtools.MediaFoundation
Imports LeadtoolsMediaFoundationExamples.Fixtures
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 19\Media"
End Class
             
   
     
            using Leadtools;
using Leadtools.MediaFoundation;
using LeadtoolsMediaFoundationExamples.Fixtures;
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 19\Media";
}