Click here to Skip to main content
11,568,522 members (49,374 online)
Click here to Skip to main content
Articles » Languages » VB.NET » General » Downloads
Add your own
alternative version

WMP Power Hour APP

, 31 Jul 2007 CPOL 35.6K 901 18
Using the Windows Media Player Component
CP Power Hour
Power Hour
Power Hour.vshost.exe
My Project
Power Hour.suo

Public Class PowerHour
    Dim startTime As DateTime
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        ' If the button is clicked then start the timer. Oncer the timer is started and the button is clicked again
        ' the timer is stopped and the player fails
        If (Timer1.Enabled) Then
            MessageBox.Show("You did not complete power hour", "Failed")
            Label3.Text = String.Empty
            Label4.Text = String.Empty
            startTime = DateTime.Now()
            Button1.Text = "Stop!"
        End If
    End Sub

    Private Sub PowerHour_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        Dim span As TimeSpan = DateTime.Now.Subtract(startTime)
        Label4.Text = span.Seconds.ToString

        ProgressBar1.Value += 1

        If ProgressBar1.Value = 60 Then
            ProgressBar1.Value = 0
            ProgressBar2.Value += 1
            Dim span2 As TimeSpan = DateTime.Now.Subtract(startTime)
            Label3.Text = span2.Minutes.ToString
            If ProgressBar2.Value = 60 Then
                MessageBox.Show("You've completed power hours", "Congratulations!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
                ProgressBar2.Value = 0
            End If
        End If
    End Sub

    Private Sub AddMusicToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AddMusicToolStripMenuItem.Click
        Dim dlg As New OpenFileDialog()
        dlg.InitialDirectory = "C:\"
        dlg.CheckFileExists = True
        dlg.Title = "Import a Playlist from WMP"
        dlg.Filter = "Windows Media Playlists|*.wpl"
        dlg.Multiselect = False
        wmp.URL = dlg.FileName
    End Sub
End Class

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Web Developer
United States United States
Still in school, program for fun...

You may also be interested in...

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.150624.2 | Last Updated 31 Jul 2007
Article Copyright 2007 by Froz3n
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid