|
From: gavin on 22 Feb 2005 10:52 Hi All, May be the title is a bit misleading! Surely someone knows what this error is. Runtime Error -2147221231 (80040111) Automation Error Class Factory cannot supply requested class It is happening on the mediacontrol.renderfile line. I am using the quartz.dll runtime files and directshow library. Please Help The whole code is here. The error is in sub file1_click. Private MediaControl(0 To 7) As IMediaControl Private MediaPosition(0 To 7) As IMediaPosition Private Timing(0 To 7) As Boolean Option Explicit Private Sub cmdEject_Click(index As Integer) Set MediaControl(index) = Nothing cmdPlay(index).Enabled = False cmdStop(index).Enabled = False cmdEject(index).Enabled = False lblName(index).Caption = "" lblDur(index).Caption = "00:00" lblTime(index).Caption = "00:00" End Sub Private Sub cmdPlay_Click(index As Integer) MediaControl(index).Run lblPlay(index).Visible = True cmdEject(index).Enabled = False End Sub Private Sub cmdStop_Click(index As Integer) MediaControl(index).Stop MediaPosition(index).CurrentPosition = 0 MediaControl(index).Pause lblPlay(index).Visible = False cmdEject(index).Enabled = True End Sub Private Sub Dir1_Change() File1.Path = Dir1.Path End Sub Private Sub Drive1_Change() Dir1.Path = Drive1.Drive End Sub Private Sub File1_Click() 'Find first free player Dim x As Integer For x = 0 To UBound(MediaControl) If MediaControl(x) Is Nothing Then Exit For Next x Dim fle1 As String fle1 = Dir1.Path & "\" & File1.FileName Set MediaControl(x) = New FilgraphManager On Error Resume Next MediaControl(x).RenderFile (fle1) If Err.Number > 0 Then MsgBox Err.Description, vbOKOnly Exit Sub End If Set MediaPosition(x) = MediaControl(x) MediaControl(x).Pause lblDur(x).Caption = Format(MediaPosition(x).Duration \ 60, "00") & ":" & Format(MediaPosition(x).Duration Mod 60, "00") lblName(x).Caption = File1.FileName cmdEject(x).Enabled = True cmdPlay(x).Enabled = True cmdStop(x).Enabled = True End Sub Private Sub Form_Load() Me.Height = 11044 Me.Width = 15364 Me.Left = 0 Me.Top = 0 End Sub Private Sub lblTime_Click(index As Integer) If Timing(index) = True Then Timing(index) = False Else Timing(index) = True End If End Sub Private Sub Timer_Timer(index As Integer) If Not MediaControl(index) Is Nothing Then If Timing(index) = True Then 'Current Time lblTime(index).Caption = Format(MediaPosition(index).CurrentPosition \ 60, "00") & ":" & Format(MediaPosition(index).CurrentPosition Mod 60, "00") Else 'Remaining Time lblTime(index).Caption = Format((MediaPosition(index).Duration - MediaPosition(index).CurrentPosition) \ 60, "00") & ":" & Format((MediaPosition(index).Duration - MediaPosition(index).CurrentPosition) Mod 60, "00") End If End If End Sub Gavin.
|
Pages: 1 Prev: Canon SDK - Passing UDT ByRef Next: Object Required Error while running MSComm32.ocx |