Advertisement
TLama

Untitled

Aug 22nd, 2015
291
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 0.90 KB | None | 0 0
  1. [Setup]
  2. AppName=My Program
  3. AppVersion=1.5
  4. DefaultDirName={pf}\My Program
  5.  
  6. [Code]
  7. #ifdef UNICODE
  8.   #define AW "W"
  9. #else
  10.   #define AW "A"
  11. #endif
  12.  
  13. const
  14.   MAX_PATH = 260;
  15.   ERROR_SUCCESS = 0;
  16.   AutoCAD2016PC = '{5783F2D7-F004-0000-5102-0060B0CE6BBA}';
  17.   INSTALLPROPERTY_INSTALLLOCATION = 'InstallLocation';
  18.  
  19. function MsiGetProductInfo(szProduct: string; szProperty: string;
  20.   lpValueBuf: string; var pcchValueBuf: DWORD): UINT;
  21.   external 'MsiGetProductInfo{#AW}@msi.dll stdcall';
  22.  
  23. procedure InitializeWizard;
  24. var  
  25.   RetVal: UINT;
  26.   BufSize: DWORD;
  27.   AppPath: string;
  28. begin
  29.   BufSize := MAX_PATH;
  30.   SetLength(AppPath, BufSize);  
  31.   RetVal := MsiGetProductInfo(AutoCAD2016PC, INSTALLPROPERTY_INSTALLLOCATION, AppPath, BufSize);
  32.   if RetVal = ERROR_SUCCESS then
  33.     MsgBox(AppPath, mbInformation, MB_OK)
  34.   else
  35.     MsgBox('Function failed. Error code: ' + IntToStr(RetVal), mbError, MB_OK);
  36. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement