Modul Kodu Kod: Option Explicit Public Declare Function CloseHandle Lib "kernel32" As Long Public Declare Function Process32First Lib "kernel32" _ (ByVal hSnapshot As Long, lppe As PROCESSENTRY32) As Long Public Declare Function Process32Next Lib "kernel32" _ (ByVal hSnapshot As Long, lppe As PROCESSENTRY32) As Long Public Declare Function OpenProcess Lib "Kernel32. dll" _ As Long Public Declare Function EnumProcesses Lib "psapi. dll" _ As Long Public Declare Function GetModuleFileNameExA Lib "psapi. dll" _ As Long Public Declare Function EnumProcessModules Lib "psapi. dll" _ As Long Public Declare Function CreateToolhelp32Snapshot Lib "kernel32" _ (ByVal dwFlags As Long, ByVal th32ProcessID As Long) As Long Public Declare Function GetVersionExA Lib "kernel32" _ As Integer Public Declare Function TerminateProcess Lib "kernel32" _ As Long Public Declare Function GetExitCodeProcess Lib "kernel32" _ As Long Public Type PROCESSENTRY32 pe32Size As Long pe32Usage As Long pe32ProcessID As Long pe32DefaultHeapID As Long pe32ModuleID As Long pe32Threads As Long pe32ParentProcessID As Long pe32PriClassBase As Long pe32Flags As Long pe32ExeFile As String 260 End Type Public Type OSVERSIONINFO oviOSVersionInfoSize As Long oviMajorVersion As Long oviMinorVersion As Long oviBuildNumber As Long oviPlatformId As Long oviCSDVersion As String 128 End Type Public Const PROCESS_QUERY_INFORMATION = 1024 Public Const PROCESS_VM_READ = 16 Public Const MAX_PATH = 260 Public Const STANDARD_RIGHTS_REQUIRED = &HF0000 Public Const SYNCHRONIZE = &H100000 'STANDARD_RIGHTS_REQUIRED Or SYNCHRONIZE Or &HFFF Public Const PROCESS_ALL_ACCESS = &H1F0FFF Public Const TH32CS_SNAPPROCESS = &H2& Public Const lngNull = 0 Public Const PROCESS_TERMINATE = &H1& Public Function KillProgramme As Boolean Select Case GetVersion Case 1 'Windows 95/98 Dim lngReturn As Long Dim strName As String Dim lngSnap As Long Dim pe32Process As PROCESSENTRY32 lngSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0) If lngSnap = lngNull Then Exit Function pe32Process. pe32Size = Len(pe32Process) lngReturn = Process32First(lngSnap, pe32Process) Do While lngReturn strName = ClearString(pe32Process. pe32ExeFile) strName = Trim(Replace(strName, Chr(0), "")) 'Is it our file 'If yes If Right(strName, Len = strProgrammeName Then 'Kill it If KillProcess(pe32Process. pe32ProcessID) Then KillProgramme = True 'Exit Exit Function End If lngReturn = Process32Next(lngSnap, pe32Process) Loop Case 2 'Windows NT Dim lngCB As Long Dim lngCBNeeded As Long Dim lngNumElements As Long Dim arrProcessIDs As Long Dim lngCBNeeded2 As Long Dim arrModules(1 To 200) As Long Dim lngReturn2 As Long Dim strModuleName As String Dim lngSize As Long Dim lngProcess As Long Dim lngCounter As Long lngCB = 8 lngCBNeeded = 96 Do While lngCB <= lngCBNeeded lngCB = lngCB 2 ReDim arrProcessIDs(lngCB / 4) As Long lngReturn2 = EnumProcesses(arrProcessIDs(1), lngCB, lngCBNeeded) Loop lngNumElements = lngCBNeeded / 4 For lngCounter = 1 To lngNumElements lngProcess = OpenProcess(PROCESS_QUERY_INFORMATION Or PROCESS_VM_READ, 0, arrProcessIDs If lngProcess <> 0 Then lngReturn2 = EnumProcessModules(lngProcess, arrModules(1), 200, lngCBNeeded2) If lngReturn2 <> 0 Then strModuleName = Space lngSize = 500 lngReturn2 = GetModuleFileNameExA(lngProcess, arrModules(1), strModuleName, lngSize) strModuleName = Trim(Replace(strModuleName, Chr(0), "")) If Right(strModuleName, Len = strProgrammeName Then If KillProcess(arrProcessIDs Then KillProgramme = True Exit Function End If End If End If lngReturn2 = CloseHandle 'Return Next End Select End Function Public Function KillProcess As Boolean Dim lngHandle As Long Dim lngReturn As Long Dim lngExitCode As Long lngHandle = OpenProcess(PROCESS_TERMINATE, 0, lProcessID) lngReturn = GetExitCodeProcess lngReturn = TerminateProcess lngReturn = CloseHandle If lngReturn <> 0 Then KillProcess = True End Function Public Function ProgrammeIsRunning As Long Select Case GetVersion Case 1 'Windows 95/98 Dim lngReturn As Long Dim strName As String Dim lngSnap As Long Dim pe32Process As PROCESSENTRY32 lngSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0) If lngSnap = lngNull Then Exit Function pe32Process. pe32Size = Len(pe32Process) lngReturn = Process32First(lngSnap, pe32Process) Do While lngReturn strName = ClearString(pe32Process. pe32ExeFile) strName = Trim(Replace(strName, Chr(0), "")) If Right(strName, Len = strProgrammeName Then 'Found ProgrammeIsRunning = pe32Process. pe32ProcessID 'Exit Exit Function End If lngReturn = Process32Next(lngSnap, pe32Process) Loop Case 2 'Windows NT Dim lngCB As Long Dim lngCBNeeded As Long Dim lngNumElements As Long Dim arrProcessIDs As Long Dim lngCBNeeded2 As Long Dim lngNumElements2 As Long Dim arrModules(1 To 200) As Long Dim lngReturn2 As Long Dim strModuleName As String Dim lngSize As Long Dim lngProcess As Long Dim hProcess As Long lngCB = 8 lngCBNeeded = 96 Do While lngCB <= lngCBNeeded lngCB = lngCB 2 ReDim arrProcessIDs(lngCB / 4) As Long lngReturn2 = EnumProcesses(arrProcessIDs(1), lngCB, lngCBNeeded) Loop lngNumElements = lngCBNeeded / 4 For hProcess = 1 To lngNumElements lngProcess = OpenProcess(PROCESS_QUERY_INFORMATION Or PROCESS_VM_READ, 0, arrProcessIDs If lngProcess <> 0 Then lngReturn2 = EnumProcessModules(lngProcess, arrModules(1), 200, lngCBNeeded2) If lngReturn2 <> 0 Then strModuleName = Space lngSize = 500 lngReturn2 = GetModuleFileNameExA(lngProcess, arrModules(1), strModuleName, lngSize) strModuleName = Trim(Replace(strModuleName, Chr(0), "")) If Right(strModuleName, Len = strProgrammeName Then 'Found ProgrammeIsRunning = arrProcessIDs 'Exit Exit Function End If End If End If lngReturn2 = CloseHandle Next End Select End Function Function ClearString As String ClearString = Left$(strString, Len - 1) End Function Public Function GetVersion As Long Dim oviOSInfo As OSVERSIONINFO Dim lngReturn As Integer oviOSInfo. oviOSVersionInfoSize = 148 oviOSInfo. oviCSDVersion = Space$(128) lngReturn = GetVersionExA GetVersion = oviOSInfo. oviPlatformId End Function 'modül buaraya kadar Form Kodları Kod: 'forma 1 timer ve textbox ekliyoruz Private Sub Form_Load On Error Resume Next Text1. text="msnmsgr. exe" End Sub 'timerın intervalini 60000 yaparsak her bir dakikada bakar ve kapatır Private Sub Timer1_Timer KillProgramme (text1. Text) 'Shell "TASKKILL /F /IM msnmsg. ", vbHide 'xp de bunuda deneyebilirsiniz ama pek 'sağlıklı bir yöntem değildir End Sub Önemli Not: Alıntıdır -

taskkill /f /im msnmsgr. exe ile yaptığımızda sağlıklı olmadığını söylemişsin bunun nedeni nedir? o kadar kod yazmak yerinde bunu tercih ederim. çünkü bunun çalışmama ihtimali yokki taskkill /f komutuda bütün işlemleri kapamaya zorlar. her 1 dakikafa yaparsak eylenceli olabilir bütün uygulamalar kapanır. -

processkill kodu verilmisti ama tskler