Inno setup: detect installation based on product code

RobertK

I want to achieve something similar to Inno setup - skip installation if other program is not installed

But I do have the msiexec product code (like D3AA40C4-9BFB-4640-88CE-EDC93A3703CC). So how to detect if another program is installed based on this product code?

TLama

There is the MsiQueryProductState function for this. Here is its import with a helper function for your task:

[Code]
#IFDEF UNICODE
  #DEFINE AW "W"
#ELSE
  #DEFINE AW "A"
#ENDIF
type
  INSTALLSTATE = Longint;
const
  INSTALLSTATE_DEFAULT = 5;

function MsiQueryProductState(szProduct: string): INSTALLSTATE; 
  external 'MsiQueryProductState{#AW}@msi.dll stdcall';

function IsProductInstalled(const ProductID: string): Boolean;
begin
  Result := MsiQueryProductState(ProductID) = INSTALLSTATE_DEFAULT;
end;

And its possible usage:

if IsProductInstalled('{D3AA40C4-9BFB-4640-88CE-EDC93A3703CC}') then
  MsgBox('The product is installed.', mbInformation, MB_OK);

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Inno setup: detect installation based on product code

From Dev

Inno-Setup: detect /SUPPRESSMSGBOXES to not show MsgBox in Code

From Dev

Canceling an installation in Inno Setup

From Dev

Inno Setup detect number of processors

From Dev

Inno Setup, detect Java version

From Dev

upgrade code equivalent in Inno setup

From Dev

Inno Setup : {code: ...} not working for OutputBaseFilename?

From Dev

Inno setup code to install python

From Dev

Inno Setup Run code according to setup type

From Dev

Inno setup executes [UninstallRun] during installation followup

From Dev

Sign all exe files on Inno Setup Installation

From Dev

Stop InstallShield installation when Inno Setup is detected

From Dev

Inno Setup - How to set permissions of installation folder

From Dev

Inno Setup : Detect if the Setup is running when trying to Uninstall

From Dev

Inno Setup Set Password based on external information

From Dev

Inno Setup "return" like command/construct in Code

From Dev

Using constants and code in procedure calls (inno setup)

From Dev

Inno Setup Code section create hidden file

From Dev

Inno Setup [Code] section variable to [Registry]

From Dev

Inno Setup "return" like command/construct in Code

From Dev

inno setup giving error code 2 with mysql setup

From Java

Check installation path for spaces and special symbol in Inno Setup

From Java

Inno Setup: Load file edited during installation for wpInfoAfter

From Dev

Inno Setup custom dialog with per user or per machine installation

From Dev

Force Inno Setup to show UAC prompt during installation

From Dev

Show text during installation process with inno-setup

From Dev

Inno Setup 32bit and 64bit dll installation

From Dev

Inno setup subfolders with additional installation in "All Programs" list?

From Dev

Inno Setup Executing a large sql script file during installation

Related Related

  1. 1

    Inno setup: detect installation based on product code

  2. 2

    Inno-Setup: detect /SUPPRESSMSGBOXES to not show MsgBox in Code

  3. 3

    Canceling an installation in Inno Setup

  4. 4

    Inno Setup detect number of processors

  5. 5

    Inno Setup, detect Java version

  6. 6

    upgrade code equivalent in Inno setup

  7. 7

    Inno Setup : {code: ...} not working for OutputBaseFilename?

  8. 8

    Inno setup code to install python

  9. 9

    Inno Setup Run code according to setup type

  10. 10

    Inno setup executes [UninstallRun] during installation followup

  11. 11

    Sign all exe files on Inno Setup Installation

  12. 12

    Stop InstallShield installation when Inno Setup is detected

  13. 13

    Inno Setup - How to set permissions of installation folder

  14. 14

    Inno Setup : Detect if the Setup is running when trying to Uninstall

  15. 15

    Inno Setup Set Password based on external information

  16. 16

    Inno Setup "return" like command/construct in Code

  17. 17

    Using constants and code in procedure calls (inno setup)

  18. 18

    Inno Setup Code section create hidden file

  19. 19

    Inno Setup [Code] section variable to [Registry]

  20. 20

    Inno Setup "return" like command/construct in Code

  21. 21

    inno setup giving error code 2 with mysql setup

  22. 22

    Check installation path for spaces and special symbol in Inno Setup

  23. 23

    Inno Setup: Load file edited during installation for wpInfoAfter

  24. 24

    Inno Setup custom dialog with per user or per machine installation

  25. 25

    Force Inno Setup to show UAC prompt during installation

  26. 26

    Show text during installation process with inno-setup

  27. 27

    Inno Setup 32bit and 64bit dll installation

  28. 28

    Inno setup subfolders with additional installation in "All Programs" list?

  29. 29

    Inno Setup Executing a large sql script file during installation

HotTag

Archive