9

I'm using Inno Setup to change the recycle bin in the OS. I need to make some cases for if the user is running Windows 7 or Windows XP. I try using:

if not FileExists(winDir + '\System32\imageres.dll') then
  if not FileExists(winDir + '\System32\shell32.dll') then
    installError(3);

But it seems like it can't find imageres.dll or shell32.dll even though I've verified they exist. What am I doing wrong? Or can I check the Windows version another way?

4

3 に答える 3

11

関数を使用する必要がありGetWindowsVersionExます。それはレコードを埋めますTWindowsVersion

TWindowsVersion = record
  Major: Cardinal;             // Major version number
  Minor: Cardinal;             // Minor version number
  Build: Cardinal;             // Build number
  ServicePackMajor: Cardinal;  // Major version number of service pack
  ServicePackMinor: Cardinal;  // Minor version number of service pack
  NTPlatform: Boolean;         // True if an NT-based platform
  ProductType: Byte;           // Product type (see below)
  SuiteMask: Word;             // Product suites installed (see below)
end;

他にもたくさんの関連機能があります。このページの下の「システム関数」を参照してください。

于 2011-05-01T18:37:55.660 に答える
7

documentationによると、各ファイルに関連付けられているパラメーターは、OS のバージョンに直接関連付けることができます。

[Files]
Source: "{app}\WinNT2000XP.exe"; DestDir: "{app}"; MinVersion: 0, 1
Source: "{app}\Win9598Me.exe"; DestDir: "{app}"; MinVersion: 1, 0

「0」はインストールしないことを意味します。"1" は、任意のバージョン (つまり、バージョン 1.0 以降) にインストールすることを意味します。

注: 上記の手法は [Files] セクションに限定されません。MinVersion と OnlyBelowVersion は、ほとんどのセクションで使用できます。

于 2011-05-01T18:44:26.040 に答える