How to detect a running MSI Installation [duplicat

2019-05-14 03:43发布

This question already has an answer here:

I'm looking for a way to detect if a Windows Installer installation is already in progress. What I've found out so far is:

  • Checking the Registry key:
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\InProgress
  • Using the Windows Installer API function MSIInstallProduct with a dummy file which then would return the specific error code.

Does anybody know a smarter solution?