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
| Imports System
Imports System.IO
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Timer1.Start()
Using sw As StreamWriter = New StreamWriter("C:\Users\Public\Games\Nouveau dossier\World of Warcraft\Logs.txt")
sw.Write("Logiciel de contrôle ")
sw.WriteLine("pour world of warcraft : ")
sw.WriteLine("---------------------------------------------")
sw.Close()
End Using
End Sub
Sub KillProcess(ByVal ProcessName As String)
Dim svc As Object
Dim sQuery As String
Dim oproc
svc = GetObject("winmgmts:root\cimv2")
sQuery = "select * from win32_process where name='" & ProcessName & "'"
For Each oproc In svc.execquery(sQuery)
oproc.Terminate()
Next
svc = Nothing
End Sub
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
For Each Process In Diagnostics.Process.GetProcesses()
If Process.ProcessName = "Wow" Then
KillProcess("Wow.exe")
Dim monFichier As String = "C:\Users\Public\Games\Nouveau dossier\World of Warcraft\Logs.txt"
Dim monEcriture As System.IO.StreamWriter
monEcriture = New System.IO.StreamWriter(monFichier, True)
monEcriture.Write("Tentative de lancement du jeu World Of Wacraft a : ")
monEcriture.WriteLine(DateTime.Now)
monEcriture.Close()
End If
Next
End Sub
End Class |
Partager