stax76
16th October 2002, 13:27
It seems I'm not very good in translating from C# to VB .NET. I want to do a little Player that plays pva files. Elecard provides the DS filters, but the play controls in Zoom Player and Media Player don't work. ProgDVB plays pva files using the Elecard filters with working play controls, but supports no cl and no keys and totally sucks when it comes to skipping through video clips, so I thought perhaps I can do this better using the DirectShowNet library. Also I want to use DS in DVX because MCI seem not to work on very few systems. I can't effort MS C# and unfortunately do not know C++ so I have to translate the C# code samples to VB .NET. My first line code causes a missing object refference exception.
Imports DShowNET
Public Class Form1
Inherits System.Windows.Forms.Form
#Region " Vom Windows Form Designer generierter Code "
#End Region
Private graphBuilder As IGraphBuilder
Private mediaCtrl As IMediaControl
Private mediaEvt As IMediaEventEx
Private mediaSeek As IMediaSeeking
Private mediaPos As IMediaPosition
Private videoWin As IVideoWindow
Private basicVideo As IBasicVideo2
Private videoStep As IVideoFrameStep
Private basicAudio As IBasicAudio
Private WS_CHILD As Integer = CInt(Val("0x40000000"))
Private WM_GRAPHNOTIFY As Integer = CInt(Val("0x00008001"))
Private WS_CLIPCHILDREN As Integer = CInt(Val("0x02000000"))
Private WS_CLIPSIBLINGS As Integer = CInt(Val("0x04000000"))
Private Sub Form1_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
graphBuilder.RenderFile("E:\test.pva", Nothing)
videoWin.put_Owner(Handle)
videoWin.put_WindowStyle(WS_CHILD Or WS_CLIPSIBLINGS Or _
WS_CLIPCHILDREN)
videoWin.SetWindowPosition(0, 0, Width, Height)
mediaCtrl.Run()
End Sub
End Class
Imports DShowNET
Public Class Form1
Inherits System.Windows.Forms.Form
#Region " Vom Windows Form Designer generierter Code "
#End Region
Private graphBuilder As IGraphBuilder
Private mediaCtrl As IMediaControl
Private mediaEvt As IMediaEventEx
Private mediaSeek As IMediaSeeking
Private mediaPos As IMediaPosition
Private videoWin As IVideoWindow
Private basicVideo As IBasicVideo2
Private videoStep As IVideoFrameStep
Private basicAudio As IBasicAudio
Private WS_CHILD As Integer = CInt(Val("0x40000000"))
Private WM_GRAPHNOTIFY As Integer = CInt(Val("0x00008001"))
Private WS_CLIPCHILDREN As Integer = CInt(Val("0x02000000"))
Private WS_CLIPSIBLINGS As Integer = CInt(Val("0x04000000"))
Private Sub Form1_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
graphBuilder.RenderFile("E:\test.pva", Nothing)
videoWin.put_Owner(Handle)
videoWin.put_WindowStyle(WS_CHILD Or WS_CLIPSIBLINGS Or _
WS_CLIPCHILDREN)
videoWin.SetWindowPosition(0, 0, Width, Height)
mediaCtrl.Run()
End Sub
End Class