Advertisement
TLama

Untitled

Dec 4th, 2014
371
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 1.11 KB | None | 0 0
  1. [Setup]
  2. AppName=My Program
  3. AppVersion=1.5
  4. DefaultDirName={pf}\My Program
  5.  
  6. [Code]
  7. const
  8.   ChromeRegKey = 'Software\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe';
  9.   FirefoxRegKey = 'Software\Mozilla\Mozilla Firefox';
  10.  
  11. // based on http://stackoverflow.com/a/22538486/960757
  12. function IsChromeInstalled: Boolean;
  13. begin
  14.   // check if there's the Chrome app registration entry under the 32-bit registry
  15.   // view of HKCU or HKLM key
  16.   Result := RegKeyExists(HKCU32, ChromeRegKey) or RegKeyExists(HKLM32, ChromeRegKey);
  17. end;
  18.  
  19. // based on http://stackoverflow.com/a/7135283/960757
  20. function IsFirefoxInstalled: Boolean;
  21. begin
  22.   // check if there's the Firefox reg key under the 32-bit registry view of HKLM
  23.   Result := RegKeyExists(HKLM32, FirefoxRegKey);
  24. end;
  25.  
  26. function InitializeSetup: Boolean;
  27. begin
  28.   // we won't continue if either of these is installed
  29.   Result := not (IsChromeInstalled or IsFirefoxInstalled);
  30.   // if we won't continue, show up a message box
  31.   if not Result then
  32.     MsgBox('You have installed Chrome and/or Firefox. Uninstall them and run this setup again.', mbError, MB_OK);
  33. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement