Leadtools.Multimedia Namespace > PlayCtrl Class : ErrorAbort Event |
public event ErrorAbortEventHandler ErrorAbort
'Declaration Public Event ErrorAbort As ErrorAbortEventHandler
'Usage Dim instance As PlayCtrl Dim handler As ErrorAbortEventHandler AddHandler instance.ErrorAbort, handler
public event ErrorAbortEventHandler ErrorAbort
add_ErrorAbort(function(sender, e)) remove_ErrorAbort(function(sender, e))
public: event ErrorAbortEventHandler^ ErrorAbort
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 175\Media"; End Class
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 175\Media"; }
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2