none
Playing Movie From CD RRS feed

  • Question

  •  

    This is really important, I am really very close to my dead-line.

    Here it is:

    cd/dvd that has many folders on it, one of them has movies (windows media. ie wmv).
    I have an interface already set-up with buttons, each of which should play one of those wmv's on the cd,
    I only need to know how to link them to the wmv's, ie how to let the user just click on any of the buttons and the
    corresponding movie he/she chose will play ????.
    Some computers have two cd/dvd players, would it make a difference which player the user chooses to put the cd in?
    ie does the code need to be changed to allow for this?

    Please any info you might think would help will be truly and desperately appreciated.

    Monday, September 1, 2008 9:56 PM

Answers

  • I'm going to take the liberty of guessing you are using the Windows Media Player control since you didn't specify how you are playing the videos in your program. How about allowing your user to navigate to the video they want by using an Open File Dialog?
        Private Sub Button2_Click(ByVal sender As System.ObjectByVal e As System.EventArgs) Handles Button2.Click  
            Dim ofd As New OpenFileDialog()  
            ofd.Filter = "WMV (*.wmv)|*.wmv" 
            ofd.InitialDirectory = "c:\" 
            ofd.Multiselect = False 
     
            If ofd.ShowDialog() = Windows.Forms.DialogResult.OK Then 
                Me.AxWindowsMediaPlayer1.URL = ofd.FileName  
            End If 
        End Sub 

    If that is not an option, you can simply link up your buttons to whatever file you like.
        Private Sub Button2_Click(ByVal sender As System.ObjectByVal e As System.EventArgs) Handles Button2.Click  
            Me.AxWindowsMediaPlayer1.URL = "d:\watever.wmv" 
        End Sub 
    Monday, September 1, 2008 11:40 PM
  • passpossa said:

    cd/dvd that has many folders on it, one of them has movies (windows media. ie wmv).
    I have an interface already set-up with buttons, each of which should play one of those wmv's on the cd,
    I only need to know how to link them to the wmv's, ie how to let the user just click on any of the buttons and the
    corresponding movie he/she chose will play?.
    Some computers have two cd/dvd players, would it make a difference which player the user chooses to put the cd in?
    ie does the code need to be changed to allow for this?


    Hi passpossa,

    Welcome to MSDN forums!

    You can use Process.Start method to launch particular application to open a file.

    Take a .txt file for example:
      ' Launch Notepad.exe to open this file      
         Process.Start("notepad.exe", "c:\Output.txt")
      ' Launch Wordpad.exe to open this file    
        Process.Start("wordpad.exe", "c:\Output.txt")

    In your scenario, take a .wmv movie file for example:

    Public Class Form1  
     
        Private Sub Button1_Click(ByVal sender As System.ObjectByVal e As System.EventArgs) Handles Button1.Click  
            ' Launch default player to play this .wmv file  
            Process.Start("D:\video1.wmv")  
            ' Launch Windows Media Player to play this .wmv file  
            Process.Start("C:\Program Files\Windows Media Player\wmplayer.exe""D:\video1.wmv")  
        End Sub 
     
        Private Sub Button2_Click(ByVal sender As System.ObjectByVal e As System.EventArgs) Handles Button2.Click  
            ' Launch Pure Codec Player to play this .wmv file  
            Process.Start("C:\Program Files\Pure Codec\KMPlayer.exe""D:\video1.wmv")  
        End Sub 
     
    End Class 

    Reference:Three approaches to Start Process
    http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2014896&SiteID=1

    If I misunderstood you, please clarify your question. Thanks!


    Best regards,
    Martin Xie

    Wednesday, September 3, 2008 5:38 AM

All replies

  •  

    This is really important, I am really very close to my dead-line.

    Here it is:

    cd/dvd that has many folders on it, one of them has movies (windows media. ie wmv).
    I have an interface already set-up with buttons, each of which should play one of those wmv's on the cd,
    I only need to know how to link them to the wmv's, ie how to let the user just click on any of the buttons and the
    corresponding movie he/she chose will play ????.
    Some computers have two cd/dvd players, would it make a difference which player the user chooses to put the cd in?
    ie does the code need to be changed to allow for this?

    Please any info you might think would help will be truly and desperately appreciated.

    Monday, September 1, 2008 9:57 PM
  • I'm going to take the liberty of guessing you are using the Windows Media Player control since you didn't specify how you are playing the videos in your program. How about allowing your user to navigate to the video they want by using an Open File Dialog?
        Private Sub Button2_Click(ByVal sender As System.ObjectByVal e As System.EventArgs) Handles Button2.Click  
            Dim ofd As New OpenFileDialog()  
            ofd.Filter = "WMV (*.wmv)|*.wmv" 
            ofd.InitialDirectory = "c:\" 
            ofd.Multiselect = False 
     
            If ofd.ShowDialog() = Windows.Forms.DialogResult.OK Then 
                Me.AxWindowsMediaPlayer1.URL = ofd.FileName  
            End If 
        End Sub 

    If that is not an option, you can simply link up your buttons to whatever file you like.
        Private Sub Button2_Click(ByVal sender As System.ObjectByVal e As System.EventArgs) Handles Button2.Click  
            Me.AxWindowsMediaPlayer1.URL = "d:\watever.wmv" 
        End Sub 
    Monday, September 1, 2008 11:40 PM
  • Hi,

    Which one of the Power Packs controls are you using for this, and what language and version?

    Steve Hoag

    Visual Basic Power Packs


    aka the V-Bee
    Tuesday, September 2, 2008 5:19 PM
    Moderator
  • passpossa said:

    cd/dvd that has many folders on it, one of them has movies (windows media. ie wmv).
    I have an interface already set-up with buttons, each of which should play one of those wmv's on the cd,
    I only need to know how to link them to the wmv's, ie how to let the user just click on any of the buttons and the
    corresponding movie he/she chose will play?.
    Some computers have two cd/dvd players, would it make a difference which player the user chooses to put the cd in?
    ie does the code need to be changed to allow for this?


    Hi passpossa,

    Welcome to MSDN forums!

    You can use Process.Start method to launch particular application to open a file.

    Take a .txt file for example:
      ' Launch Notepad.exe to open this file      
         Process.Start("notepad.exe", "c:\Output.txt")
      ' Launch Wordpad.exe to open this file    
        Process.Start("wordpad.exe", "c:\Output.txt")

    In your scenario, take a .wmv movie file for example:

    Public Class Form1  
     
        Private Sub Button1_Click(ByVal sender As System.ObjectByVal e As System.EventArgs) Handles Button1.Click  
            ' Launch default player to play this .wmv file  
            Process.Start("D:\video1.wmv")  
            ' Launch Windows Media Player to play this .wmv file  
            Process.Start("C:\Program Files\Windows Media Player\wmplayer.exe""D:\video1.wmv")  
        End Sub 
     
        Private Sub Button2_Click(ByVal sender As System.ObjectByVal e As System.EventArgs) Handles Button2.Click  
            ' Launch Pure Codec Player to play this .wmv file  
            Process.Start("C:\Program Files\Pure Codec\KMPlayer.exe""D:\video1.wmv")  
        End Sub 
     
    End Class 

    Reference:Three approaches to Start Process
    http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2014896&SiteID=1

    If I misunderstood you, please clarify your question. Thanks!


    Best regards,
    Martin Xie

    Wednesday, September 3, 2008 5:38 AM