Inno Setup checks and closes the running process before Setup starts and before the uninstaller starts

Source: Internet
Author: User

(2011-12-29 11:54:56) reproduced
Tags:innosetupit Category: Development tools Experience accumulation
Inno Setup before installing the program, if there is a process in use that is running, there will be an error, which makes installer unable to write. Similarly, before uninstalling the program, if a process is still running, there will be an error, and then the uninstallation is not clean and needs to be cleaned manually. So, as long as you check and close the running process before you install the program or uninstall the program, there is no problem. [Code] //Pre-installation check off * * ProcessProcedure curstepchanged(curstep:tsetupstep); var appwnd:hwnd;begin if curstep = Ssinstall then BEGIN//check if the XX process is running, then close the process appwnd: = F     Indwindowbywindowname (' Process window name ');       if (appwnd <> 0) THEN begin PostMessage (Appwnd, 18, 0, 0);  Quit end; End;end; //Check off before uninstalling * * ProcessProcedure curuninstallstepchanged(curuninstallstep:tuninstallstep); var appwnd:hwnd;begin//Check if the process is running, then close the process appwnd: = findwindowbywindowname (' Process window   Name ');       if (appwnd <> 0) THEN begin PostMessage (Appwnd, 18, 0, 0); Quit End;end; Of these, Pascal provides two functions to find the process window: FindwindowbyclassnameAnd Findwindowbywindowname, the former is based on the class name, which is based on the window name to find the top-level window handle that matches it. You can turn on the process and use the Spy + + tool to get the window name or class name for the process.

Inno Setup checks and closes the running process before Setup starts and before the uninstaller starts

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.