• Welcome to TechPowerUp Forums, Guest! Please check out our forum guidelines for info related to our community.

Simple Media Player Code.

Joined
Mar 5, 2007
Messages
212 (0.05/day)
Likes
3
Processor Intel Core 2 Duo E6420 3.2 GHz
Motherboard Asus P5K Motherboard
Cooling Air
Memory 2 GB Crucial DDR 800
Video Card(s) NVIDIA GeForce 7950 GT 512MB GDDR3 PCI-E
Storage Seagate 400 GB S-Ata II, Seagate 500 GB S-Ata II, WD 500 GB S-ATA II
Display(s) Acer 22" LCD
Case Apevia
Audio Device(s) Creative SB X-FI Xtreme Gamer
Power Supply Apevia 500 W
Software Window XP Home
#1
(VB6) Simple Media Player Code.

' Code Written By Jordan aka Glitched
' Simple media player code
' Sorry if you see the code as a mess
' Enjoy
'
' On Form 1 Place a WindowsMediaPlayer DLL,
' Place TWO timers. This is for the form caption
' Place Two Labels One for the "Server IP:" caption and for "Volume:" Caption
' Place ONE TextBox, This is where you enter your url.
'
' Button That Makes Media Player Start.
Private Sub Command1_Click()
WindowsMediaPlayer1.URL = Text1.Text
WindowsMediaPlayer1.Enabled = True
If Text1.Text = "" Then
MsgBox ("Enter A URL Dummy ")
End If
If Text1.Text = "" Then
Command1.Enabled = True
Command3.Enabled = False
Command4.Enabled = False
Command5.Enabled = False
Command6.Enabled = False
Command7.Enabled = False
Command2.Enabled = False
Else
Command2.Enabled = True
Command3.Enabled = True
Command4.Enabled = True
Command5.Enabled = True
Command6.Enabled = True
Command7.Enabled = True
Command1.Enabled = False
End If
End Sub

' Button that makes media player stop
Private Sub Command2_Click()
If WindowsMediaPlayer1.Enabled = False Then
MsgBox (" You are not listening to music!")
End If
WindowsMediaPlayer1.Enabled = False
WindowsMediaPlayer1.Controls.Stop
Command1.Enabled = True
Command3.Enabled = False
Command4.Enabled = False
Command5.Enabled = False
Command6.Enabled = False
Command7.Enabled = False
Command2.Enabled = False

End Sub

' Volume Control
Private Sub Command3_Click()
Form1.WindowsMediaPlayer1.settings.volume = 25
Label2.Caption = "Volume Level: " & Command3.Caption
End Sub

Private Sub Command4_Click()
Form1.WindowsMediaPlayer1.settings.volume = 50
Label2.Caption = "Volume Level: " & Command4.Caption
End Sub

Private Sub Command5_Click()
Form1.WindowsMediaPlayer1.settings.volume = 75
Label2.Caption = "Volume Level: " & Command5.Caption
End Sub

Private Sub Command6_Click()
Label2.Caption = "Volume Level: " & Command6.Caption
Form1.WindowsMediaPlayer1.settings.volume = 100
End Sub

Private Sub Command7_Click()
Form1.WindowsMediaPlayer1.settings.volume = 0
Label2.Caption = "Volume Level: " & Command7.Caption
End Sub

Private Sub Form_Load()
Command1.Caption = " Click Me To Play "
Timer1.Enabled = True
Timer1.Interval = 300
Form1.Caption = " Jordan's Online Media Player Version 2 "
Timer2.Enabled = True
Timer2.Interval = 300
Command1.Enabled = True
Command3.Enabled = False
Command4.Enabled = False
Command5.Enabled = False
Command6.Enabled = False
Command7.Enabled = False
Command2.Enabled = False
Command1.Caption = "Click Me to Play"
Command2.Caption = "Music Off"
Command3.Caption = "25 %"
Command4.Caption = "50 %"
Command5.Caption = "75 %"
Command6.Caption = "100 %"
Command7.Caption = "Mute"
Label2.Caption = "Volume: 50 %"
Label1.Caption = "Server IP:"
Form1.Height = "1770"
End Sub

' Scrolls Form1 Caption
Private Sub Timer2_Timer()
Dim str As String
str = Form1.Caption
str = Mid$(str, 2, Len(str)) + Left(str, 1)
Form1.Caption = str
End Sub
 
Last edited:
Top