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 58 59 60 61 62 63 64 65 66
| Private Sub Button_Optimiser_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button_Optimiser.Click
Me.DialogResult = System.Windows.Forms.DialogResult.OK
Button_Optimiser.Enabled = False
Button_Optimiser.BackColor = Color.Empty
Button_Fermer.Enabled = False
Button_NormalConfig.Visible = False
Button_ExplorerSTART.Visible = False
Label_EnCours.Visible = True
Label_Optimiser.Visible = False
Dim TerminerProcessus() As Process = Process.GetProcesses 'récupère la liste des processus de Windows (Attention, ce sont des tableaux)
For x As Integer = 0 To UBound(TerminerProcessus) 'Recherche ds la liste (en boucle)
If TerminerProcessus(x).ProcessName.ToString = "cmd" Then
TerminerProcessus(x).Kill()
End If
' TouchPad ----------------------------------------------------
If TerminerProcessus(x).ProcessName.ToString = "Apoint" Then
TerminerProcessus(x).Kill()
End If
If TerminerProcessus(x).ProcessName.ToString = "ApntEx" Then
TerminerProcessus(x).Kill()
End If
' et les autres process...
Next
TimerOptimiser.Interval = (15000)
TimerOptimiser.Start()
End Sub
Private Sub TimerOptimiser_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TimerOptimiser.Tick
Shell("cmd.exe /k taskkill /F /IM explorer.exe", AppWinStyle.Hide)
System.Threading.Thread.Sleep(3000) ' y'a pas mieux pour attendre la fin ?
Dim TerminerProcessus() As Process = Process.GetProcesses
For x As Integer = 0 To UBound(TerminerProcessus)
If TerminerProcessus(x).ProcessName.ToString = "cmd" Then
TerminerProcessus(x).Kill()
End If
Next
TimerOptimiser.Stop()
System.Threading.Thread.Sleep(3000)
'Me.WindowState = FormWindowState.Normal
Button_Optimiser.Dispose()
Button_NormalConfig.Dispose()
Button_ExplorerSTART.Dispose()
Button_Fermer.Dispose()
Panel_Buttons.Dispose()
Panel_Labels.Dispose()
'Me.Dispose()
'My.Application.ApplicationContext.MainForm.Dispose()
'Me.Finalize
FormMini.Show()
Me.Close()
End Sub |
Partager