how to close .exe

Feb 26, 2015 at 10:57pm
what is the code or function to close opening file.exe .. browser like chrome.exe or game.exe or what ever ?

i know the code to open file.exe

ShellExecute(0,
"open", // Operation to perform
"c:\\windows\\notepad.exe", // Application name
"c:\\example.txt", // Additional parameters
0, // Default directory
SW_SHOW);

Thank You .

Last edited on Mar 8, 2015 at 11:32pm
Feb 27, 2015 at 5:45pm
Get a list of processes:
https://msdn.microsoft.com/en-us/library/ms682629(VS.85).aspx
For each process, get the filename:
https://msdn.microsoft.com/en-us/library/ms683217(v=vs.85).aspx
When you find the process you don't want, terminate it:
https://msdn.microsoft.com/en-us/library/windows/desktop/ms686714%28v=vs.85%29.aspx
Just be aware that Sarah Connor isn't that easy to kill.

By the way, this is highly dependent on your operating system - I can tell you're using Windows, so this should be in the Windows Programming section. You can click Edit Topic at the top of this page to fix that.
Last edited on Feb 27, 2015 at 5:46pm
Mar 1, 2015 at 4:04pm
okay thank you for your comment and sry for late for replay .. i edited the topic as you said .. and i will check your links ..
thank you .
Mar 7, 2015 at 6:00pm
If you are spawning the process then already have he handle and you have full rights, no need to enumerate all running processes to get it.

However, ShellExecute will not give you the handle, use ShellExecuteEx or CreateProcess instead.
Mar 8, 2015 at 11:31pm
Thanks ..
i used this code
system("taskkill /F /T /IM file.exe");
Topic archived. No new replies allowed.