If Playing = True Then WindowsMediaPlayer1.Controls.play
OldMem = Memory
Else
MsgBox "You need to set this streams link."
End If
End Function
Private Sub Command4_Click()
On Error Resume Next
WindowsMediaPlayer1.SetFocus
Preselect 2, True
End Sub
Private Sub Command5_Click()
On Error Resume Next
WindowsMediaPlayer1.SetFocus
Preselect 3, True
End Sub
Private Sub Command6_Click()
On Error Resume Next
WindowsMediaPlayer1.SetFocus
Preselect 4, True
End Sub
Private Sub Command7_Click()
On Error Resume Next
WindowsMediaPlayer1.SetFocus
Preselect 5, True
End Sub
Private Sub MnuVisualize_Click()
If WindowsMediaPlayer1.playState = wmppsPlaying Then
WindowsMediaPlayer1.fullScreen = True
Else
MsgBox "Media must be playing before you can use this feature !"
End If
End Sub
Private Sub AlarmTimeDsp_Click()
Command1_Click
End Sub
Private Sub Check1_Click()
On Error Resume Next
WindowsMediaPlayer1.SetFocus
If Check1.Value = 1 And AlarmFile = vbNullString Then MsgBox "Please set the backup alarm file.": Settings.Show: Timer2.Enabled = True: Check1.Value = 0
If Check1.Value = 1 And AlarmStream = vbNullString Then MsgBox "Please set at least one stream.": Settings.Show: Timer2.Enabled = True: Check1.Value = 0
SaveSetting "Streaming Radio Alarm Clock", "Settings", "AlarmSet", Check1.Value
End Sub
Private Sub Command1_Click()
On Error Resume Next
WindowsMediaPlayer1.SetFocus
Settings.Show
Timer2.Enabled = True
If (Me.Top + Me.Height) + Settings.Height > Screen.Height Then Me.Top = Screen.Height - ((Me.Height + Settings.Height) + 1000)
End Sub
Private Sub Form_Load()
If App.PrevInstance Then
Unload Settings
Unload Me
End If
Me.Hide
MyCap = Me.Caption
AlarmFile = GetSetting("Streaming Radio Alarm Clock", "Settings", "AlarmFile", vbNullString)
WindowsMediaPlayer1.Settings.autoStart = False 'This here is a very important ingrediant
WindowsMediaPlayer1.Settings.volume = 100
Preselect GetSetting("Streaming Radio Alarm Clock", "Settings", "Memory", "1")
AlarmTime = CDate(GetSetting("Streaming Radio Alarm Clock", "Settings", "AlarmTime", "6:30:00 AM"))
Check1.Value = GetSetting("Streaming Radio Alarm Clock", "Settings", "AlarmSet", Check1.Value)
AddToTray Me, "Streaming Radio Alarm Clock", Me.Icon
If AlarmFile = vbNullString Then MsgBox "Please set the backup alarm file.": Me.Show: Command1_Click: Exit Sub
If AlarmStream = vbNullString Then MsgBox "Please set at least one stream.": Me.Show: Command1_Click
End Sub
Private Sub Form_Unload(Cancel As Integer)
RemoveFromTray
Unload Settings
Unload Me
End Sub
Private Sub MnuExit_Click()
Unload Me
End Sub
Private Sub MnuShow_Click()
Me.Show
End Sub
Private Sub Timer1_Timer()
If Hour(Now) = Hour(AlarmTime) And Minute(Now) = Minute(DateAdd("n", -1, AlarmTime)) And Second(Now) = "0" And Check1.Value = 1 And WindowsMediaPlayer1.playState = wmppsPlaying Then WindowsMediaPlayer1.Controls.stop 'Makes sure mediaplayer is ready to alarm. Just in case someone goes to sleep with the radio going.
If Hour(Now) = Hour(AlarmTime) And Minute(Now) = Minute(AlarmTime) And Second(Now) = "0" And Check1.Value = 1 Then
Me.Show
PlayItLoud
End If
Clock
End Sub
Private Sub Clock()
If Military = True Then
Label1.Caption = Format(Now, "h:mm:ss")
Else
Label1.Caption = Format(Now, "h:mm:ss AMPM")
End If
Label2.Caption = Format(Now, "dddd, mmm d yyyy")
End Sub
Private Sub Timer2_Timer() 'Settings docking timer
Private Sub WindowsMediaPlayer1_MediaError(ByVal pMediaObject As Object)
WindowsMediaPlayer1.URL = AlarmFile
WindowsMediaPlayer1.Controls.play
MsgBox "Couldn't connect to internet !"
End Sub
Private Sub WindowsMediaPlayer1_PlayStateChange(ByVal NewState As Long)
Select Case NewState
Case wmppsMediaEnded
WindowsMediaPlayer1.Controls.stop
Case wmppsReady
WindowsMediaPlayer1.Controls.stop
Case wmppsStopped
SetMasterVolume_Value OgVol
WindowsMediaPlayer1.URL = AlarmStream
End Select
End Sub
Public Sub PlayItLoud()
Dim eType As eConnectionType
Dim sName As String
If WindowsMediaPlayer1.playState = wmppsStopped Or WindowsMediaPlayer1.playState = wmppsUndefined Or WindowsMediaPlayer1.playState = wmppsReady Then
If GetSetting("Streaming Radio Alarm Clock", "Settings", "RadioStream", "1") = 0 Or InternetConnected(sName, eType) = False Or AlarmStream = vbNullString Then
If AlarmFile = vbNullString Then MsgBox "Please choose a alarm sound file !": Exit Sub
OgVol = GetMasterVolume_Value
MasterVolume_Mute True, False
SetMasterVolume_Value "90"
WindowsMediaPlayer1.URL = AlarmFile
Else
OgVol = GetMasterVolume_Value
MasterVolume_Mute True, False
SetMasterVolume_Value "90"
WindowsMediaPlayer1.URL = AlarmStream
End If
WindowsMediaPlayer1.Controls.play
Else
WindowsMediaPlayer1.Controls.stop
SetMasterVolume_Value OgVol
End If
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)