I have a function that ends process of active window. it gets window handle then finds its process id and ends its process. but the problem is (explorer.exe)
I want to put a condition to ignore end process if the process name is equal to (explorer.exe)
But i don't know how
This is my code:
Code:Private Sub ENDS_WINDOW_PROCESS(Window_Handle As Long) Dim target_process_id As Long Dim target_process_handle As Long If Window_Handle = 0 Then 'MsgBox "Error finding target window handle" Exit Sub End If GetWindowThreadProcessId Window_Handle, target_process_id If target_process_id = 0 Then 'MsgBox "Error finding target process ID" Exit Sub End If target_process_handle = OpenProcess(SYNCHRONIZE Or PROCESS_TERMINATE, ByVal 0&, target_process_id) If target_process_handle = 0 Then 'MsgBox "Error finding target process handle" Exit Sub End If If TerminateProcess(target_process_handle, 0&) = 0 Then 'MsgBox "Error terminating process" Else 'MsgBox "Process terminated" End If CloseHandle target_process_handle End Sub




Reply With Quote
