Windows Media Player

Discussion in 'Programming General' started by kharg0, Jan 27, 2008.

?

Helpful?

  1. Yes

    0 vote(s)
    0.0%
  2. Its good

    100.0%
  3. A little

    0 vote(s)
    0.0%
  4. No

    0 vote(s)
    0.0%
Windows Media Player
  1. Unread #1 - Jan 27, 2008 at 11:27 AM
  2. kharg0
    Joined:
    Feb 25, 2007
    Posts:
    131
    Referrals:
    0
    Sythe Gold:
    0

    kharg0 Active Member

    Windows Media Player

    Ok i got some codes that i made myself with a little help from x zero (A little)

    Go to your toolbox right click press choose items... When you get in press the com tab then go to almost the bottom where you find windows media player check it and press ok then it will be in your toolbox.:D

    After that has been finished place 2 buttons on your page first one's text as Add and the second ones text as Remove (haven't got remove 2 work)Add a Listview and then add a Menubar and a windows media player control. (organize however you want)double click the menu bar and add file then drop down add Open.
    double click the open drop down when you get to its code put it as

    Code:
    Try
                OpenFileDialog1.InitialDirectory = "desktop/My Documents"
                OpenFileDialog1.ShowDialog()
                AxWindowsMediaPlayer1.URL = OpenFileDialog1.FileName
                AxWindowsMediaPlayer1.Ctlcontrols.play()
                OpenFileDialog1.Filter = "Supported Media (avi, mid, mp3, mpg, mpeg, mp4, wav, wma, wmv)|*.avi;*.mid;*.mp3; *.mpg; *.mpeg;*.mp4;*.wav;*.wma;*.wmv|Audio Media (*.mid, *.mp3, *.wav, *.wma|*.mid;*.mp3;*.wav;*.wma|Video Media (*.avi, *.mpg, *.mpeg, *.wmv)|*.avi;*.mpg;*.mpeg;*.wmv"
            Catch ex As Exception
                MessageBox.Show("Some error occur so can't play media", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
            End Try
    i got that from x zero

    but added some

    nowdouble click add this is where i trail of his tutorial making it easier and with less code.

    code as
    Code:
    Try
                OpenFileDialog1.InitialDirectory = "desktop/My Documents"
                OpenFileDialog1.ShowDialog()
                AxWindowsMediaPlayer1.URL = OpenFileDialog1.FileName
                AxWindowsMediaPlayer1.Ctlcontrols.play()
                OpenFileDialog1.Filter = "Supported Media (avi, mid, mp3, mpg, mpeg, mp4, wav, wma, wmv)|*.avi;*.mid;*.mp3; *.mpg; *.mpeg;*.mp4;*.wav;*.wma;*.wmv|Audio Media (*.mid, *.mp3, *.wav, *.wma|*.mid;*.mp3;*.wav;*.wma|Video Media (*.avi, *.mpg, *.mpeg, *.wmv)|*.avi;*.mpg;*.mpeg;*.wmv"
                ListView1.Items.Add(OpenFileDialog1.FileName)
            Catch ex As Exception
                MessageBox.Show("Some error occur so can't play media", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
            End Try
    this will add the file location to your listview (insure how to get it to double click to play send a code please.)

    this might work for remove button

    Code:
    ListView1.SelectedItems.Clear
    so your code should resemble this.

    Code:
    Public Class Form1
    
        Private Sub OpenToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OpenToolStripMenuItem.Click
            Try
                OpenFileDialog1.InitialDirectory = "desktop/My Documents"
                OpenFileDialog1.ShowDialog()
                AxWindowsMediaPlayer1.URL = OpenFileDialog1.FileName
                AxWindowsMediaPlayer1.Ctlcontrols.play()
                OpenFileDialog1.Filter = "Supported Media (avi, mid, mp3, mpg, mpeg, mp4, wav, wma, wmv)|*.avi;*.mid;*.mp3; *.mpg; *.mpeg;*.mp4;*.wav;*.wma;*.wmv|Audio Media (*.mid, *.mp3, *.wav, *.wma|*.mid;*.mp3;*.wav;*.wma|Video Media (*.avi, *.mpg, *.mpeg, *.wmv)|*.avi;*.mpg;*.mpeg;*.wmv"
            Catch ex As Exception
                MessageBox.Show("Some error occur so can't play media", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
            End Try
        End Sub
    
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            Try
                OpenFileDialog1.InitialDirectory = "desktop/My Documents"
                OpenFileDialog1.ShowDialog()
                AxWindowsMediaPlayer1.URL = OpenFileDialog1.FileName
                AxWindowsMediaPlayer1.Ctlcontrols.play()
                OpenFileDialog1.Filter = "Supported Media (avi, mid, mp3, mpg, mpeg, mp4, wav, wma, wmv)|*.avi;*.mid;*.mp3; *.mpg; *.mpeg;*.mp4;*.wav;*.wma;*.wmv|Audio Media (*.mid, *.mp3, *.wav, *.wma|*.mid;*.mp3;*.wav;*.wma|Video Media (*.avi, *.mpg, *.mpeg, *.wmv)|*.avi;*.mpg;*.mpeg;*.wmv"
                ListView1.Items.Add(OpenFileDialog1.FileName)
            Catch ex As Exception
                MessageBox.Show("Some error occur so can't play media", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
            End Try
        End Sub
    
        Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
            ListView1.SelectedItems.Clear()
        End Sub
    thanks for any one who can help prefect this code!:cool:
     
  3. Unread #2 - Jan 27, 2008 at 1:45 PM
  4. skate4lifee
    Joined:
    Jul 22, 2007
    Posts:
    108
    Referrals:
    1
    Sythe Gold:
    0

    skate4lifee Active Member

    Windows Media Player

  5. Unread #3 - Jan 27, 2008 at 2:30 PM
  6. kharg0
    Joined:
    Feb 25, 2007
    Posts:
    131
    Referrals:
    0
    Sythe Gold:
    0

    kharg0 Active Member

    Windows Media Player

    ya i know but this is more recent things that i have done and it simlifies a lot of the codes on that page.
     
< HELP C++ My pictures deletion | [suggestion] application request section? >

Users viewing this thread
1 guest


 
 
Adblock breaks this site