I need a little help :)
My program opens up internet ports in the windows firewall for help with downloading via bit torrent or conenction issues with msn or steam.
Now at the moment i have 3 settings , 1 hour, 2 hours or permenant but since this program leaves internet ports open i feel it would be a bit risky to just leave them like they are so i want to create a Till Shutdown Button
Im not sure how to go about this though, would i have to use a timer to check the process list every 2 seconds for shutdown.exe or is there another way?

Dim m_datTarget As DateTime = CDate("09/21/2009 7:00PM")

    Private Sub Timer1_Tick(...) Handles Timer1.Tick

        Dim tsDiff As TimeSpan

        If m_datTarget < Now Then
            Timer1.Enabled = False
            'Put your shut down code here
            MessageBox.Show("They end...")
            Exit Sub
        End If

        tsDiff = m_datTarget.Subtract(Now)
        Label1.Text = String.Format("Time Remaining : {0}", FormatElapsedTime(tsDiff))

    End Sub

    Public Function FormatElapsedTime(ByVal ts As TimeSpan) As String

        Dim strResult As String = "0 Milliseconds"

        If ts.Hours > 0 Then
            strResult = String.Format("{0:#0}:{01:00}:{02:00} hours", _
                                            ts.Hours, ts.Minutes, ts.Seconds)
        ElseIf ts.Minutes > 0 Then
            strResult = String.Format("{0:#0}:{01:00} minutes", _
                                            ts.Minutes, ts.Seconds)
        ElseIf ts.Seconds > 0 Then
            strResult = String.Format("{0:#0} seconds", ts.Seconds)

        ElseIf ts.Milliseconds > 0 Then
            strResult = String.Format("{0:##0} milliseconds", _
                                            ts.Milliseconds)
        End If

        Return strResult

    End Function
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.