Results 1 to 19 of 19

Thread: Remake of my MP3 Player using Windows Media Player

Threaded View

  1. #1

    Thread Starter
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Remake of my MP3 Player using Windows Media Player

    Hi,

    Here is the remake of a mini media player which, I made back in 2002.

    Check post #14 for latest project/s.

    frmMain code:
    vb Code:
    1. 'How to use the Windows Media Player
    2. 'control (version 11.0) in Visual Basic 6.0 to play music
    3. 'Date: 15/04/2011
    4. 'Author: Aaron Spehr
    5. 'Alias: Nightwalker83
    6. 'Website: http://aaronspehr.net/
    7.  
    8. Private Sub Form_Load()
    9.  Me.Caption = "Mini MP3 Player"
    10. 'Integer index of the song to be played
    11.  s = 0
    12. 'Disable the song duration timer
    13.  tmrDuration.Enabled = False
    14.  frmSetup.Songopt(0).Value = True
    15.  mnuStop.Checked = True
    16.  frmSetup.Caption = "Setup"
    17. End Sub
    18.  
    19.  
    20. Private Function play(s)
    21.  frmSetup.Lstsongs.Selected(s) = True
    22.  MediaPlayer1.URL = frmSetup.Lstsongs.Text
    23. End Function
    24.  
    25. Private Sub mnuExit_Click()
    26.  'Close the player
    27. MediaPlayer1.Close
    28.  Unload Me
    29. End Sub
    30.  
    31. Private Sub mnuForward_Click()
    32. MediaPlayer1.Controls.fastForward
    33. mnuForward.Checked = True
    34. mnuRewind.Checked = False
    35. mnuPlay.Checked = False
    36. End Sub
    37.  
    38. Private Sub mnuPause_Click()
    39. 'Pause the current song
    40.  mnuPause.Checked = Not mnuPause.Checked
    41.  pause
    42. End Sub
    43.  
    44. Private Sub mnuPlay_Click()
    45. 'If cancel then close the program
    46. 'Else choose and play a song
    47. Music1.ShowOpen
    48. frmSetup.Lstsongs.AddItem Music1.FileName
    49. Repeat:
    50.  x = MsgBox("Do you want to add more songs?", vbYesNo)
    51. If x = vbYes Then
    52. Music1.ShowOpen
    53. frmSetup.Songopt(1).Value = True
    54. frmSetup.Lstsongs.AddItem Music1.FileName
    55. GoTo Repeat
    56. ElseIf x = vbNo Then
    57. play (s)
    58. mnuPlay.Checked = True
    59. mnuStop.Checked = False
    60. tmrDuration.Enabled = True
    61. End If
    62. If x = vbNo And frmSetup.Lstsongs.Text = "" Or Err.Number = "32755" Then
    63. 'Stop the player
    64. MediaPlayer1.Close
    65. x = vbNo
    66. Unload Me
    67. End If
    68. End Sub
    69.  
    70. Private Sub mnuRewind_Click()
    71. 'Rewind the song after pausing
    72.  pause
    73. 'MediaPlayer1.Controls.fastReverse
    74. mnuRewind.Checked = True
    75. mnuForward.Checked = False
    76. mnuPlay.Checked = False
    77. End Sub
    78.  
    79. Private Sub pause()
    80.  'If mnuPause is not checked continue playing the song
    81.  If mnuPause.Checked = False Then
    82.  MediaPlayer1.Controls.play
    83.  Else
    84.  'If mnuPause is checked pause the song
    85.  mnuPause.Checked = True
    86.  MediaPlayer1.Controls.pause
    87. End If
    88. End Sub
    89.  
    90. Private Sub mnuSettings_Click()
    91. frmSetup.Show vbModal, Me
    92. End Sub
    93.  
    94. Private Sub mnuStop_Click()
    95. 'Stop the player
    96. mnuStop.Checked = True
    97. mnuRewind.Checked = False
    98. mnuForward.Checked = False
    99. mnuPlay.Checked = False
    100. 'Disable the song duration timer
    101. tmrDuration.Enabled = False
    102. MediaPlayer1.Controls.stop
    103. frmSetup.Lstsongs.Clear
    104. Me.Caption = "Mini MP3 Player"
    105. End Sub
    106.  
    107. Private Sub tmrDuration_Timer()
    108. 'Displays the current position and the total duration of the current song.
    109. Me.Caption = MediaPlayer1.Controls.currentPositionString + " \ " + MediaPlayer1.currentMedia.durationString + " " + MediaPlayer1.currentMedia.Name
    110. If MediaPlayer1.playState = wmppsStopped And frmSetup.Songopt(1).Value = True And Not s > frmSetup.Lstsongs.ListCount Then
    111. 'Play the next song in the list
    112.  s = s + 1
    113. play (s)
    114. End If
    115. End Sub

    frmSetup code:
    vb Code:
    1. Private Sub cmdBack_Click()
    2. hideme
    3. End Sub
    4.  
    5. Private Sub hideme()
    6. Me.Hide
    7. frmMain.Show
    8. End Sub

    Comments or ideas on how I can improve the project are welcome. I might create a great project if I get enough ideas.


    Nightwalker
    Attached Files Attached Files
    Last edited by Nightwalker83; May 27th, 2012 at 11:37 PM. Reason: Adding new project!
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width