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.
strProg := 'iexplore.exe';
winHwnd := FindWindowByWindowName(strProg);
MsgBox('winHwnd: ' + inttostr(winHwnd), mbInformation, MB_OK );
if winHwnd <> 0 then
retVal:=postmessage(winHwnd,WM_CLOSE,0,0);
The message box in the example above will always return 0 therefore no handle is ever gotten.
(the WM_CLOSE
constant in the example is properly initialized)
I need another way of doing this, and hopefully one that does not involve writing a C++ DLL that does this (I am not proficient in C++, I might be able to write a DLL in C#, however I don't know whether Inno Setup will interop with that).
This C# DLL would get the process list, iterate thru the names of processes, find a match (=="iexplorer") and then kill the processes with that name...however I am still hoping to find an easier solution so that I wouldnt have to interop it with Pascal script.
Thanks in advance!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…