Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [Setup]
- AppName=My Program
- AppVersion=1.5
- DefaultDirName={pf}\My Program
- InfoBeforeFile=d:\INNOProposal.txt
- OutputDir=userdocs:Inno Setup Examples Output
- [Code]
- #IFDEF UNICODE
- #DEFINE AW "W"
- #ELSE
- #DEFINE AW "A"
- #ENDIF
- type
- INSTALLSTATE = Longint;
- const
- INSTALLSTATE_INVALIDARG = -2; // An invalid parameter was passed to the function.
- INSTALLSTATE_UNKNOWN = -1; // The product is neither advertised or installed.
- INSTALLSTATE_ADVERTISED = 1; // The product is advertised but not installed.
- INSTALLSTATE_ABSENT = 2; // The product is installed for a different user.
- INSTALLSTATE_DEFAULT = 5; // The product is installed for the current user.
- VC_2008_SP1_REDIST_X86 = '{9A25302D-30C0-39D9-BD6F-21E6EC160475}';
- function MsiQueryProductState(szProduct: string): INSTALLSTATE;
- external 'MsiQueryProductState{#AW}@msi.dll stdcall';
- function InitializeSetup: Boolean;
- var
- S: string;
- State: INSTALLSTATE;
- begin
- Result := False;
- State := MsiQueryProductState(VC_2008_SP1_REDIST_X86);
- case State of
- INSTALLSTATE_INVALIDARG: S := 'INSTALLSTATE_INVALIDARG: An invalid parameter was passed to the function.';
- INSTALLSTATE_UNKNOWN: S := 'INSTALLSTATE_UNKNOWN: The product is neither advertised or installed.';
- INSTALLSTATE_ADVERTISED: S := 'INSTALLSTATE_ADVERTISED: The product is advertised but not installed.';
- INSTALLSTATE_ABSENT: S := 'INSTALLSTATE_ABSENT: The product is installed for a different user.';
- INSTALLSTATE_DEFAULT: S := 'INSTALLSTATE_DEFAULT: The product is installed for the current user.';
- else
- S := IntToStr(State) + 'Unexpected result';
- end;
- MsgBox(S, mbInformation, MB_OK);
- end;
Advertisement
Add Comment
Please, Sign In to add comment