Search code examples
windowsshellvb6windows-xpshutdown

VB 6 - remove/hide system shutdown counter | shutdown shell command


IDE - VB 6.0

Testing System - Windows XP

I am using the shutdown shell command Shell ("shutdown -s -f -t 15") to shut down the machine. The problem is when I executing the command a system shutdown counter is also appearing by default, as you can see in the picture below

img_shutdown_counter

If I set -t 00, the system shutdown counter is not appearing but the machine is shutting down without any delay which I don't want.

I want to wait 15 sec, also I want not to see this shutdown counter in the 15 sec waiting period.

Any ideas, how I can achieve this?


Solution

  • Solution

    Take a Timer control

    Properties of the Timer

    Enabled -> True

    Interval -> 1000

    Code

    Dim x As Integer
    
    Private Sub Form_Load()
    Timer1.Enabled = False
    x = 15
    End Sub
    
    Private Sub btnShutdown_Click()
    Timer1.Enabled = True
    End Sub
    
    Private Sub Timer1_Timer()
    
    x = x - 1
    
    If x = 0 Then
    Shell ("shutdown -s -f -t 00")
    End If
    
    End Sub
    

    Thanks to @Steeeve for the hint.