I'm trying to programatically close a process.
I know I can use TerminateProcess(), but I heard it's not a preferred method. I then however came across a method of terminating a process within Windows by using this command via command prompt or the Run dialog:
Code:
C:\Windows\System32\taskkill.exe -f -im explorer.exe
Using the same technique I came up with this code
Code:
ShellExecute(NULL, (LPCWSTR)"open", TEXT("C:\\Windows\\System32\\taskkill.exe"), TEXT("-f -im explorer.exe"), NULL, SW_SHOWNORMAL);
It compiles fine, but doesn't close the process. Any ideas what I'm doing wrong?