Vb.net and Directx help needed
Vb.net and Directx help needed
Vb.net and Directx help needed
Vb.net and Directx help needed
Vb.net and Directx help needed
Vb.net and Directx help needed Vb.net and Directx help needed Vb.net and Directx help needed Vb.net and Directx help needed Vb.net and Directx help needed Vb.net and Directx help needed Vb.net and Directx help needed Vb.net and Directx help needed
Vb.net and Directx help needed Vb.net and Directx help needed
Vb.net and Directx help needed
Go Back  Xtreme Visual Basic Talk > > > > Vb.net and Directx help needed


Reply
 
Thread Tools Display Modes
  #1  
Old 04-14-2005, 04:01 PM
Akriados666 Akriados666 is offline
Newcomer
 
Join Date: Apr 2005
Posts: 1
Default Vb.net and Directx help needed


I'm working on making a small game and upon starting the program (form_load) I'm trying to get a video to play using directx.
Can anyone help me with the code I need, I tried a set of code I found on here, but it didn't seem to work at all. Also I'm using directx9 (if that helps, which it probably does.)

Thankz

Last edited by Akriados666; 04-14-2005 at 04:39 PM.
Reply With Quote
  #2  
Old 04-15-2005, 01:06 AM
ardman ardman is offline
Contributor
 
Join Date: Jan 2002
Posts: 126
Talking

Try this class:
Code:
Imports Microsoft.DirectX.AudioVideoPlayback
Public Class clsVideo
    Public VideoSize As Size
    Private VideoWindow As Windows.Forms.Control
    Private Shared WithEvents DxVideo As Video
    Private Const VIDEOS_PATH As String = "Videos"

    Public Shared ReadOnly Property IsPlaying() As Boolean
        Get
            Try
                If DxVideo.CurrentPosition = DxVideo.Duration Or _
                    DxVideo.CurrentPosition < 0.5 Then
                    IsPlaying = False
                Else
                    IsPlaying = True
                End If
            Catch
                '  Ignore error if DxVideo is not initialized
            End Try
        End Get
    End Property

    ' The class methods
    Public Sub New(ByVal WndVideo As Windows.Forms.Control)
        ' Stores the video window control and size for later use
        VideoWindow = WndVideo
        VideoSize = VideoWindow.Size
    End Sub

    Public Sub Play(ByVal strFileName As String)
        ' Store the path to the file.
        strFileName = Application.StartupPath & "\" & VIDEOS_PATH & "\" & strFileName
        DxVideo = Nothing
        ' Set the control used as a owner to play the videos
        DxVideo = New Video(strFileName)
        DxVideo.Owner = VideoWindow
        ' Start playing
        DxVideo.Play()
        ' We must set the video window size again, because
        '  playing a video resizes the windows to the video's
        '  default size
        VideoWindow.Size = VideoSize
    End Sub

    Public Sub StopVideo()
        ' If there's no media running, there might be errors.
        '  -> We'll just ignore them
        Try
            DxVideo.Stop()
        Catch
        End Try
    End Sub
End Class
__________________
Cheers
Reply With Quote
  #3  
Old 05-07-2005, 06:25 AM
ThePentiumGuy ThePentiumGuy is offline
Regular
 
Join Date: May 2003
Posts: 53
Default

Really helpful, thanks!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Vb.net and Directx help needed
Vb.net and Directx help needed
Vb.net and Directx help needed Vb.net and Directx help needed
Vb.net and Directx help needed
Vb.net and Directx help needed
Vb.net and Directx help needed Vb.net and Directx help needed Vb.net and Directx help needed Vb.net and Directx help needed Vb.net and Directx help needed Vb.net and Directx help needed Vb.net and Directx help needed
Vb.net and Directx help needed
Vb.net and Directx help needed
 
Vb.net and Directx help needed
Vb.net and Directx help needed
 
-->