I have already implemented a way to find whether a process (\"iexplore.exe\") is running, I now need to find a way to close it (terminate the process) from Inno Setup.
I had this problem, and wrote a short C++ program to kill certain processes that might be in a hung state and thus unable to respond to messages telling them to die. I only did this with applications that were part of my product, not system applications.
You could do the same thing in Pascal script if you want to suffer the pain of getting the calling parameters correct. Here is an outline of what I did:
Get the location of CSIDL_PROGRAM_FILES. Inno setup can do this with its {pf} or {pf32} constants. Or call the Windows api SHGetSpecialFolderLocation function.
Set a string equal to the path to the process you want to kill, for example String target = pf + "Mycompany/MyAppFolder/myHelperApp.exe"
Call the Windows api function CreateToolhelp32Snapshot, which returns a list of running processes.
Look through this returned list for your target using the Windows api's OpenProcess and GetModuleFleNameEx.
When you find the target call the Windows api TerminateProcess on the target process handle.