Перейти из форума на сайт.

НовостиФайловые архивы
ПоискАктивные темыТоп лист
ПравилаКто в on-line?
Вход Забыли пароль? Первый раз на этом сайте? Регистрация
Компьютерный форум Ru.Board » Компьютеры » Программы » Inno Setup (создание инсталяционных пакетов)

Модерирует : gyra, Maz

Widok (02-08-2010 12:04): Лимит страниц. Продолжаем здесь.  Версия для печати • ПодписатьсяДобавить в закладки
На первую страницук этому сообщениюк последнему сообщению

   

GDS666

Newbie
Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору
[Setup]
AppName=Call of Duty - Modern Warfare 2 [AlterIWnet]
AppVerName=Call of Duty - Modern Warfare 2 [AlterIWnet 1.3.37a]
AppVersion=1.3.37a
AppPublisher=GDS666
AppPublisherURL=http://cod64.ru/
DefaultDirName={pf}\Call of Duty - Modern Warfare 2 [AlterIWnet]
DefaultGroupName=CoD-MW 2 [AlterIWnet]
AllowNoIcons=yes
InfoBeforeFile=C:\Users\Dragon Rising\Desktop\readme.txt
OutputDir=C:\Users\Dragon Rising\Desktop
OutputBaseFilename=setup
SetupIconFile=C:\Users\Dragon Rising\Desktop\gds666.ico
WizardImageFile=C:\Users\Dragon Rising\Desktop\Untitled-1.bmp
WizardSmallImageFile=C:\Users\Dragon Rising\Desktop\IS.bmp
WindowVisible=yes
WindowShowCaption=no
WindowStartMaximized=no
WindowResizable=no
DiskSpanning=yes
SlicesPerDisk=1
DiskSliceSize=2100000000
DiskClusterSize=4096
ReserveBytes=0
Compression=lzma/ultra64
SolidCompression=yes
 
 
[Messages]
BeveledLabel=Edition by GDS666
 
[Languages]
Name: "russian"; MessagesFile: "compiler:Languages\Russian.isl"
 
[Run]
Filename: "{src}\Programms\GScan\GScan_1.0.3.7.exe"; Tasks: "gscan";
Filename: "{src}\Programms\DirectX\DXSETUP.exe"; Tasks: "directx";
Filename: "{src}\Programms\Stimulus\stimulus.exe"; Tasks: "stimulus";
Filename: "{src}\Programms\Framework\framework_4.0.exe"; Tasks: "framework";
 
[UninstallDelete]
Type: filesandordirs; Name: "{app}";
 
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}";
Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
Name: "gscan"; Description: "GScan 1.0.3.7";
Name: "directx"; Description: "Установить DirectX 9.0c";
Name: "stimulus"; Description: "Stimulus 1.0.0.0(Рекомендуется)";
Name: "framework"; Description: "Установить Framework 4.0(Рекомендуется)";
 
 
[Files]
Source: "C:\Games\mw2\*"; DestDir: "{app}"; Flags: ignoreversion createallsubdirs recursesubdirs;
Source: "80548617.bmp"; DestDir: "{tmp}";
Source: "BASS.dll"; DestDir: "{tmp}"; Flags: dontcopy noencryption;
Source: "sound.mp3"; DestDir: "{tmp}"; Flags: dontcopy noencryption nocompression;
Source: "MusicButton.bmp"; DestDir: "{tmp}"; Flags: dontcopy;
Source: "splash.bmp"; DestDir: "{tmp}"; Flags: dontcopy;
Source: "callnsis.dll"; DestDir: "{tmp}"; Flags: dontcopy;
Source: "AdvSplash.dll"; DestDir: "{tmp}"; Flags: dontcopy;
 
[Icons]
Name: "{group}\Запустить игру"; Filename: "{app}\iw4mp.exe"
Name: "{group}\Лаунчер"; Filename: "{app}\launcher.exe"
Name: "{group}\Трейнер"; Filename: "{app}\trainer.exe"
Name: "{group}\Удалить игру"; Filename: "{uninstallexe}"
Name: "{commondesktop}\Лаунчер"; Filename: "{app}\launcher.exe"; Tasks: desktopicon
Name: "{commondesktop}\Трейнер"; Filename: "{app}\trainer.exe"; Tasks: desktopicon
 
[Code]
type
 PDisplay_Device = record
  cb: DWord;
  DeviceName: array [0..31] of char;
  DeviceString: array [0..127] of char;
  StateFlags: DWord;
  DeviceID, DeviceKey: array [0..127] of char;
 end;
 
 TMixerCaps = record
  vPid, vDriverVersion: DWord;
  sName: array [0..31] of char;
  Support, cDestinations: DWord;
 end;
 
// Проверка версии Windows
#if Pos("4.", GetFileVersion(AddBackslash(GetEnv("windir")) + "Explorer.exe")) == 1
    {Win9x}    
   TMemoryStatusEx = record
    dwLength, dwMemoryLoad: DWord;
    LoTotalPhys, LoAvailPhys, LoTotalPageFile, LoAvailPageFile,
    LoTotalVirtual, LoAvailVirtual, LoAvailExtendedVirtual, HiTotalPhys,
    HiAvailPhys, HiTotalPageFile, HiAvailPageFile, HiTotalVirtual, HiAvailVirtual,
    HiAvailExtendedVirtual: Integer;
   end;
  function GlobalMemoryStatusEx(var lpBuffer: TMemoryStatusEx): Boolean;
   external 'GlobalMemoryStatus@kernel32.dll stdcall';
#else
    {WinNT}
   TMemoryStatusEx = record
    dwLength, dwMemoryLoad: DWord;
    LoTotalPhys, HiTotalPhys, LoAvailPhys, HiAvailPhys,
    LoTotalPageFile, HiTotalPageFile, LoAvailPageFile, HiAvailPageFile,
    LoTotalVirtual, HiTotalVirtual, LoAvailVirtual, HiAvailVirtual, LoAvailExtendedVirtual,
    HiAvailExtendedVirtual: Integer;
   end;
  function GlobalMemoryStatusEx(var lpBuffer: TMemoryStatusEx): Boolean;
   external 'GlobalMemoryStatusEx@kernel32.dll stdcall';
#endif
 
const
  DISPLAY_DEVICE_PRIMARY_DEVICE = 4;
  oneMB = 1024*1024;
  NeedMHz = 2200;
  NeedVideoRAM = 256;
  NeedSoundCard = 'Creative X-Fi';
  NeedMB = 512;
  NeedPageFile = 1024;
 
var
  InfoPage: TWizardPage;
  TopText, BottomText: TNewStaticText;
  ChangeText: Boolean;
  SystemPanel, ProcessorPanel, VideoPanel,
  AudioPanel, RAMPanel, PageFilePanel: TMemo;
  SystemVersionPanel, ProcessorMHzPanel, VideoRAMPanel,
  AudioNamePanel, RAMTotalPanel, PageFileTotalPanel: TMemo;
  lpCaps: TMixerCaps;
  Version: TWindowsVersion;
  MemoryEx: TMemoryStatusEx;
  n, errCode: Integer;
  Keys: TArrayOfString;
  DeviceValue: Cardinal;
  lpDisplayDevice: PDisplay_Device;
 
function GetSystemMetrics(nIndex: Integer): Integer;
 external 'GetSystemMetrics@user32.dll stdcall';
 
function GetDeviceCaps(hDC, nIndex: Integer): Integer;
 external 'GetDeviceCaps@GDI32 stdcall';
 
function CreateDC(lpDriverName, lpDeviceName, lpOutput: String; lpInitData: Integer): Integer;
 external 'CreateDCA@GDI32 stdcall';
 
function EnumDisplayDevices(lpDevice, iDevNum: DWord; var lpDisplayDevice: PDisplay_Device; dwFlags: DWord): Boolean;
 external 'EnumDisplayDevicesA@user32.dll stdcall';
 
function mixerGetDevCaps(uDeviceID: LongInt; var lpCaps: TMixerCaps; uSize: LongInt): LongInt;
 external 'mixerGetDevCapsA@winmm.dll stdcall';
 
function mixerGetNumDevs: Integer;
 external 'mixerGetNumDevs@winmm.dll stdcall';
 
// Дополнить число до кратного Multiple
function ToMultiple(Bytes, Multiple: Integer): Integer;
begin
  if Abs(Bytes/Multiple) > Bytes/Multiple then
     Result := (Bytes/Multiple + 1)*Multiple
  else
     Result := Bytes
end;
 
// Перевод числа в значение Бт/Кб/Мб/Гб/Тб (до 3х знаков после запятой)
function ByteOrTB(Bytes: Extended; noMB: Boolean): String;
begin
 if not noMB then
    Result := FloatToStr(Int(Bytes)) + ' Мб'
 else
        if Bytes < 1024 then
       Result := FloatToStr(Int(Bytes)) + ' Бт'
    else
             if Bytes/1024 < 1024 then
          Result := FloatToStr(round((Bytes/1024)*10)/10) + ' Кб'
       else
                    if Bytes/oneMB < 1024 then
             Result := FloatToStr(round(Bytes/oneMB*100)/100) + ' Мб'
          else
             if Bytes/oneMB/1000 < 1024 then
                Result := FloatToStr(round(Bytes/oneMB/1024*1000)/1000) + ' Гб'
             else
                              Result := FloatToStr(round(Bytes/oneMB/oneMB*1000)/1000) + ' Тб'
 StringChange(Result, ',', '.')
end;
 
// Удаление начальных, конечных и повторных пробелов
function DelSp(String: String): String;
begin    
 while (Pos('  ', String) > 0) do Delete(String, Pos('  ', String), 1)
 Result := Trim(String)
end;
 
function Size64(Hi, Lo: Integer): Extended;
begin
 Result := Lo
 if Lo < 0 then
    Result := Result + $7FFFFFFF + $7FFFFFFF + 2
 for Hi := Hi-1 downto 0 do Result := Result + $7FFFFFFF + $7FFFFFFF + 2
end;
    
function CheckCPU(NeedMHz: Integer): Boolean;
var
  String: String;
begin
    String := 'Hardware\Description\System\CentralProcessor'; RegGetSubkeyNames(HKLM, String, Keys)     // Количество ядер
    for n := 0 to GetArrayLength(Keys)-1 do
      RegQueryStringValue(HKLM, String + '\' + Keys[n], 'ProcessorNameString', Keys[n])
    if not RegQueryDWordValue(HKLM, String + '\0', '~MHz', DeviceValue) or (DeviceValue < NeedMHz) then
         Exit
  else
     Result := True
end;
    
function CheckMemorySize(NeedRAM: Integer): Boolean;
begin
    MemoryEx.dwLength := SizeOf(MemoryEx)
    if not GlobalMemoryStatusEx(MemoryEx) then
         MsgBox('Ошибка функции:' + #13 + 'GlobalMemoryStatusEx', mbError, mb_Ok)
  else
       if (ToMultiple(trunc(Size64(MemoryEx.HiTotalPhys, MemoryEx.LoTotalPhys)/oneMB), 16) < NeedRAM) then
         Exit
     else
         Result := True
end;
    
procedure CreateCheckForm();
begin
 
  TopText := TNewStaticText.Create(InfoPage)
  with TopText do
  begin
    Parent := InfoPage.Surface
    Left := 0
    AutoSize := True
  end
 
  BottomText := TNewStaticText.Create(InfoPage)
  with BottomText do
  begin
    Parent := InfoPage.Surface
    Caption := 'Когда Вы будете готовы продолжить установку, нажмите «Далее».'
    Font.Color := clBlack
    Left := 0
    Top := 200
    AutoSize := True
  end
 
  SystemPanel := TMemo.Create(InfoPage)
  with SystemPanel do
  begin
    Text := 'Система'
    Alignment := taCenter
    Parent := InfoPage.Surface
    Left := ScaleX(0)
    Top := ScaleY(33)
    Width := ScaleX(100)
    Height := ScaleY(22)
    ReadOnly := True
    Color := $EEEEEE
  end
 
  SystemVersionPanel := TMemo.Create(InfoPage)
  with SystemVersionPanel do
  begin
    Alignment := taLeftJustify
    Parent := InfoPage.Surface
    Left := ScaleX(104)
    Top := SystemPanel.Top
    Width := ScaleX(310)
    Height := ScaleY(22)
    ReadOnly := True
   end
 
  ProcessorPanel := TMemo.Create(InfoPage)
  with ProcessorPanel do
  begin
    Text := 'Процессор'
    Alignment := taCenter
    Parent := InfoPage.Surface
    Left := ScaleX(0)
    Top := SystemPanel.Top + 27
    Width := ScaleX(100)
    Height := ScaleY(22)
    ReadOnly := True
    Color := $EEEEEE
  end
 
  ProcessorMHzPanel := TMemo.Create(InfoPage)
  with ProcessorMHzPanel do
  begin
    Alignment := taLeftJustify
    Parent := InfoPage.Surface
    Left := ScaleX(104)
    Top := ProcessorPanel.Top
    Width := ScaleX(310)
    Height := ScaleY(22)
    ReadOnly := True
  end
 
  VideoPanel := TMemo.Create(InfoPage)
  with VideoPanel do
  begin
    Text := 'Видеоадаптер'
    Alignment := taCenter
    Parent := InfoPage.Surface
    Left := ScaleX(0)
    Top := ProcessorPanel.Top + 27
    Width := ScaleX(100)
    Height := ScaleY(22)
    ReadOnly := True
    Color := $EEEEEE
  end
 
  VideoRAMPanel := TMemo.Create(InfoPage)
  with VideoRAMPanel do
  begin
    Alignment := taLeftJustify
    Parent := InfoPage.Surface
    Left := ScaleX(104)
    Top := VideoPanel.Top
    Width := ScaleX(310)
    Height := ScaleY(22)
    ReadOnly := True
  end
 
  AudioPanel := TMemo.Create(InfoPage)
  with AudioPanel do
  begin
    Text := 'Звуковая карта'
    Alignment := taCenter
    Parent := InfoPage.Surface
    Left := ScaleX(0)
    Top := VideoPanel.Top + 27
    Width := ScaleX(100)
    Height := ScaleY(22)
    ReadOnly := True
    Color := $EEEEEE
  end
 
  AudioNamePanel := TMemo.Create(InfoPage)
  with AudioNamePanel do
  begin
    Alignment := taLeftJustify
    Parent := InfoPage.Surface
    Left := ScaleX(104)
    Top := AudioPanel.Top
    Width := ScaleX(310)
    Height := ScaleY(22)
    ReadOnly := True
  end
 
  RAMPanel := TMemo.Create(InfoPage)
  with RAMPanel do
  begin
    Text := 'Объём памяти'
    Alignment := taCenter
    Parent := InfoPage.Surface
    Left := ScaleX(0)
    Top := AudioPanel.Top + 27
    Width := ScaleX(100)
    Height := ScaleY(22)
    ReadOnly := True
    Color := $EEEEEE
  end
 
  RAMTotalPanel := TMemo.Create(InfoPage)
  with RAMTotalPanel do
  begin
    Alignment := taLeftJustify
    Parent := InfoPage.Surface
    Left := ScaleX(104)
    Top := RAMPanel.Top
    Width := ScaleX(310)
    Height := ScaleY(22)
    ReadOnly := True
  end
 
  PageFilePanel := TMemo.Create(InfoPage)
  with PageFilePanel do
  begin
    Text := 'Файл подкачки'
    Alignment := taCenter
    Parent := InfoPage.Surface
    Left := ScaleX(0)
    Top := RAMPanel.Top + 27
    Width := ScaleX(100)
    Height := ScaleY(22)
    ReadOnly := True
    Color := $EEEEEE
  end;
 
  PageFileTotalPanel := TMemo.Create(InfoPage)
  with PageFileTotalPanel do
  begin
    Alignment := taLeftJustify
    Parent := InfoPage.Surface
    Left := ScaleX(104)
    Top := PageFilePanel.Top
    Width := ScaleX(310)
    Height := ScaleY(22)
    ReadOnly := True
  end
 
end;
 
procedure UpdateInfo();
var
  DeviceName, DeviceKey: String;
begin
  ChangeText := False
 
  GetWindowsVersionEx(Version)
 
  // Операционная система:
  SystemVersionPanel.Color := $CCFFCC
 
  DeviceKey := 'Software\Microsoft\Windows NT\CurrentVersion'
  if not UsingWinNT then StringChange(DeviceKey, 'Windows NT', 'Windows')
    RegQueryStringValue(HKLM, DeviceKey, 'ProductName', DeviceName)
  if RegQueryStringValue(HKLM, DeviceKey, 'CSDVersion', DeviceKey) then
     DeviceName := DeviceName + ' ' + DeviceKey
    StringChange(DeviceName, 'Microsoft ', '')
  SystemVersionPanel.Text := ' ' + DeviceName + ' сборка ' + IntToStr(Version.Major) + '.' + IntToStr(Version.Minor) +
                             '.' + IntToStr(Version.Build)
 
  if (Pos('2000 Service Pack 4', SystemVersionPanel.Text) = 0) and  // Windows 2000 SP4
     (Pos('XP Service Pack 2', SystemVersionPanel.Text) = 0) and  // Windows XP SP2
     (Pos('Vista', SystemVersionPanel.Text) = 0) then  // Windows Vista (c любым SP или без него)
     begin
      SystemVersionPanel.Color := $CCCCFF
      ChangeText := True
     end
 
  // Процессор:
  ProcessorMHzPanel.Color := $CCFFCC
 
  if not CheckCPU(NeedMHz) then
     begin
       ProcessorMHzPanel.Color := $CCCCFF
       ChangeText := True
     end
 
  ProcessorMHzPanel.Text := ' ' + DelSp(Keys[0]) + ' @' + IntToStr(DeviceValue) + ' MHz'
  if GetArrayLength(Keys) > 1 then
     ProcessorPanel.Text := 'Процессоры' // + ' (' + IntToStr(GetArrayLength(Keys)) + ')'
 
  // Видеокарта:
  VideoRAMPanel.Color := $CCFFCC
 
  lpDisplayDevice.cb := SizeOf(lpDisplayDevice)
  DeviceKey := ''
    n := 0
  while not (EnumDisplayDevices(0, n, lpDisplayDevice, 0) and
            (lpDisplayDevice.StateFlags and DISPLAY_DEVICE_PRIMARY_DEVICE > 0)) and (n < 127) do n := n + 1
    for n := 0 to 127 do DeviceKey := DeviceKey + lpDisplayDevice.DeviceKey[n]
  Delete(DeviceKey, Pos(Chr(0), DeviceKey), 127)  // Ключ драйвера получаем из API
    StringChange(DeviceKey, '\Registry\Machine\', '')
  errCode := 1
  DeviceValue := 0    
  if RegQueryBinaryValue(HKLM, DeviceKey, 'HardwareInformation.MemorySize', DeviceName) then
         for n := 1 to Length(DeviceName) do
       begin
         DeviceValue := DeviceValue + Ord(DeviceName[n])*errCode
         errCode := errCode*$100
       end
  else
     if RegQueryDWordValue(HKLM, DeviceKey, 'HardwareInformation.MemorySize', DeviceValue) then
     else
        RegQueryDWordValue(HKLM, DeviceKey + '\Info', 'VideoMemory', DeviceValue)
    DeviceName := ''
  for n := 0 to 127 do DeviceName := DeviceName + lpDisplayDevice.DeviceString[n]
  Delete(DeviceName, Pos(Chr(0), DeviceName), 127)
 
  if DeviceName <> '' then
    if DeviceValue > 0 then
      VideoRAMPanel.Text := ' ' + DelSp(DeviceName) + ', '+ ByteOrTB(DeviceValue/oneMB, False)
    else
      VideoRAMPanel.Text := ' ' + DelSp(DeviceName) + ' (Standard), '+ ByteOrTB(DeviceValue/oneMB, False)
  else
     begin
      VideoRAMPanel.Text := ' Драйвер устройства не обнаружен'
      VideoRAMPanel.Color := $CCCCFF
      ChangeText := True
     end
  if (DeviceValue/oneMB < NeedVideoRAM) then
     begin
       VideoRAMPanel.Color := $CCCCFF
       ChangeText := True
     end
  VideoRAMPanel.Text := VideoRAMPanel.Text + ', ' + IntToStr(GetSystemMetrics(0)) + 'x' +
                        IntToStr(GetSystemMetrics(1)) + ' (' + IntToStr(GetDeviceCaps(CreateDC('DISPLAY','','',0),14) *
                        GetDeviceCaps(CreateDC('DISPLAY','','',0),12)) + ' bit)'
 
  // Звуковая карта:
  AudioNamePanel.Color := $CCFFCC
 
  // for errCode := 0 to 1 do  // Вывод основного звукового устройства
  for errCode := 0 to mixerGetNumDevs do
    begin
          mixerGetDevCaps(errCode-1, lpCaps, SizeOf(lpCaps))
      DeviceName := ' '
          for n := 0 to 31 do DeviceName := DeviceName + lpCaps.sName[n]
      Delete(DeviceName, Pos(Chr(0), DeviceName), 31)
      Delete(DeviceName, Pos(' [', DeviceName), 31)
      StringChange(DeviceName, 'SB ', 'Creative ')
      Delete(DeviceName, Pos(' Audio', DeviceName), 31)
          SetArrayLength(Keys, errCode)
      if errCode > 0 then Keys[errCode-1] := DeviceName
    end
 
    if GetArrayLength(Keys) > 1 then
    begin
     AudioPanel.Text := 'Звуковые карты'
     // AudioPanel.Text := 'Звуковые карты (' + IntToStr(GetArrayLength(Keys)) +')'
     AudioNamePanel.Text := ''
     for n := 1 to GetArrayLength(Keys) do
         AudioNamePanel.Text := AudioNamePanel.Text + Keys[n-1]  // + '(' + IntToStr(n) + ')'
    end
   else
    if GetArrayLength(Keys) = 0 then
     begin
      AudioNamePanel.Text := ' Драйвер устройства не обнаружен'
      AudioNamePanel.Color := $CCCCFF
      ChangeText := True
     end
      else
       AudioNamePanel.Text := Keys[0]
  if Pos(NeedSoundCard, AudioNamePanel.Text) = 0 then
     AudioNamePanel.Text := AudioNamePanel.Text + ' (рекомендуется ' + NeedSoundCard + ')'
 
  // Объём памяти:
    RAMTotalPanel.Color := $CCFFCC
  if not CheckMemorySize(NeedMB) then
    begin
      RAMTotalPanel.Color := $CCCCFF
      ChangeText := True
    end
  RAMTotalPanel.Text := ' ' + ByteOrTB(ToMultiple(trunc(Size64(MemoryEx.HiTotalPhys, MemoryEx.LoTotalPhys)/oneMB), 16), False) + ' всего, ' +
                              ByteOrTB(ToMultiple(trunc(Size64(MemoryEx.HiTotalPhys, MemoryEx.LoTotalPhys)/oneMB), 16) -
                                                        Size64(MemoryEx.HiAvailPhys, MemoryEx.LoAvailPhys)/oneMB, False) + ' используется, ' +
                              ByteOrTB(Size64(MemoryEx.HiAvailPhys, MemoryEx.LoAvailPhys)/oneMB, False) + ' свободно'
 
  // Виртуальная память:
  PageFileTotalPanel.Color := $CCFFCC
  PageFileTotalPanel.Text := ' ' + ByteOrTB(Size64(MemoryEx.HiTotalPageFile, MemoryEx.LoTotalPageFile)/oneMB, False) + ' всего, ' +
                                   ByteOrTB((Size64(MemoryEx.HiTotalPageFile, MemoryEx.LoTotalPageFile) -
                                             Size64(MemoryEx.HiAvailPageFile, MemoryEx.LoAvailPageFile))/oneMB, False) + ' занято системным кэшем'
  if Size64(MemoryEx.HiTotalPageFile, MemoryEx.LoTotalPageFile)/oneMB < NeedPageFile then
    begin
      PageFileTotalPanel.Color := $CCCCFF
      ChangeText := True
    end
 
  if ChangeText = True then
    begin
      TopText.Top := 0
      TopText.Caption := 'Не все компоненты удовлетворяют минимальным требованиям игры.' #13
                         'Пожалуйста, проверьте позиции, выделенные красным цветом.'
      TopText.Font.Color := clRed
      // WizardForm.NextButton.Enabled := False
    end
  else
    begin
      TopText.Caption := 'Все компоненты соответствуют минимальным требованиям игры.'
      TopText.Font.Color := clGreen
      TopText.Top := 8
      // WizardForm.NextButton.Enabled := True
    end
end;
 
procedure callplug(parentwnd: Integer; pluginname,funcname,param1,param2,param3,param4,param5,param6,param7,param8,param9,param10: PChar);
 external 'callplug@files:callnsis.dll stdcall';
 
const
  BASS_ACTIVE_STOPPED = 0;
  BASS_ACTIVE_PLAYING = 1;
  BASS_ACTIVE_STALLED = 2;
  BASS_ACTIVE_PAUSED = 3;
  BASS_SAMPLE_LOOP = 4;
 
var
  mp3Handle: HWND;
  mp3Name: String;
  PlayButton, PauseButton, StopButton: TPanel;
  PlayImage, PauseImage, StopImage: TBitmapImage;
  PlayLabel, PauseLabel, StopLabel: TLabel;
  MouseLabel: Tlabel;
 
function BASS_Init(device: Integer; freq, flags: DWORD; win: hwnd; CLSID: Integer): Boolean;
  external 'BASS_Init@files:BASS.dll stdcall delayload';
 
function BASS_StreamCreateFile(mem: BOOL; f: PChar; offset: DWORD; length: DWORD; flags: DWORD): DWORD;
  external 'BASS_StreamCreateFile@files:BASS.dll stdcall delayload';
 
function BASS_Start(): Boolean;
  external 'BASS_Start@files:BASS.dll stdcall delayload';
 
function BASS_ChannelPlay(handle: DWORD; restart: BOOL): Boolean;
  external 'BASS_ChannelPlay@files:BASS.dll stdcall delayload';
 
function BASS_ChannelIsActive(handle: DWORD): Integer;
  external 'BASS_ChannelIsActive@files:BASS.dll stdcall delayload';
 
function BASS_ChannelPause(handle: DWORD): Boolean;
  external 'BASS_ChannelPause@files:BASS.dll stdcall delayload';
 
function BASS_Stop(): Boolean;
  external 'BASS_Stop@files:BASS.dll stdcall delayload';
 
function BASS_Pause(): Boolean;
  external 'BASS_Pause@files:BASS.dll stdcall delayload';
 
function BASS_Free(): Boolean;
  external 'BASS_Free@files:BASS.dll stdcall delayload';
 
procedure PlayMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
  PlayImage.Left := -96
end;
 
procedure PlayMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
  PlayImage.Left := 0
end;
 
procedure PlayMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
begin
  if PlayImage.Left <> -96 then PlayImage.Left := -192
  StopImage.Left := -64
end;
 
procedure PauseMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
  PauseImage.Left := -128
end;
 
procedure PauseMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
  PauseImage.Left := -32
end;
 
procedure PauseMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
begin
  if PauseImage.Left <> -128 then PauseImage.Left := -224
  StopImage.Left := -64
end;
 
procedure StopMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
  StopImage.Left := -160
end;
 
procedure StopMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
  StopImage.Left := -64
end;
 
procedure StopMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
begin
  if StopImage.Left <> -160 then StopImage.Left := -256
  PlayImage.Left := 0
  PauseImage.Left := -32
end;
 
procedure MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
begin
  PlayImage.Left := 0
  PauseImage.Left := -32
  StopImage.Left := -64
end;
 
function InitializeSetup(): Boolean;
begin
  ExtractTemporaryFile('BASS.dll');
  ExtractTemporaryFile('sound.mp3');
  mp3Name := ExpandConstant('{tmp}\sound.mp3');
  BASS_Init(-1, 44100, 0, 0, 0);
  mp3Handle := BASS_StreamCreateFile(FALSE, PChar(mp3Name), 0, 0, BASS_SAMPLE_LOOP);
  BASS_Start();
  BASS_ChannelPlay(mp3Handle, False);
  Result := True;
end;
 
procedure PlayButtonOnClick(Sender: TObject);
begin
  case BASS_ChannelIsActive(mp3Handle) of
    BASS_ACTIVE_PAUSED:
      begin
        BASS_ChannelPlay(mp3Handle, False);
        PlayButton.Hide
        PauseButton.Show
      end;
    BASS_ACTIVE_STOPPED:
      begin
        BASS_Init(-1, 44100, 0, 0, 0);
        mp3Handle := BASS_StreamCreateFile(FALSE, PChar(mp3Name), 0, 0, BASS_SAMPLE_LOOP);
        BASS_Start();
        BASS_ChannelPlay(mp3Handle, False);
        PlayButton.Hide
        PauseButton.Show
      end;
  end;
end;
 
procedure PauseButtonOnClick(Sender: TObject);
begin
  BASS_ChannelPause(mp3Handle);
  PauseButton.Hide
  PlayButton.Show
end;
 
procedure StopButtonOnClick(Sender: TObject);
begin
  BASS_Stop();
  BASS_Free();
  PauseButton.Hide
  PlayButton.Show
end;
 
procedure InitializeWizard();
var
BackImage: TBitmapImage;
begin
  ExtractTemporaryFile('splash.bmp')
  ExtractTemporaryFile('AdvSplash.dll')
  callplug(0,ExpandConstant('{tmp}\AdvSplash.dll'),'show','3000','2000','1500','-1',ExpandConstant('{tmp}\splash'),'','','','','')
  ExtractTemporaryFile('80548617.bmp')
  WizardForm.Position:=poScreenCenter
  MainForm.BorderStyle:=bsNone
  BackImage:=TBitmapImage.Create(MainForm)
  BackImage.Align:=alClient
  BackImage.Stretch:=True
  BackImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\80548617.bmp'))
  BackImage.Parent:=MainForm
  WizardForm.Caption:='Установка игры...'
  InfoPage := CreateCustomPage(wpLicense, 'Аппаратное и программное обеспечение',
                                          'Программа установки обнаружила следующие необходимые компоненты.')
  CreateCheckForm()  // Создание объектов TMemo, в которых будет выводится информация о системе
  UpdateInfo()  // Обновление информации о системе
end;
 
var
 Page: TWizardPage;
begin
  WizardForm.BackButton.BringToFront;
  WizardForm.NextButton.BringToFront;
  WizardForm.CancelButton.BringToFront;
  WizardForm.BeveledLabel.Enabled:=True;
  WizardForm.BeveledLabel.Font.Color:=$00AA4509;;
  WizardForm.BeveledLabel.Font.Style := WizardForm.BeveledLabel.Font.Style + [fsBold];
  WizardForm.BeveledLabel.Color:=$dbcdcc;
  WizardForm.BeveledLabel.Left:=10;
  WizardForm.BeveledLabel.Top:=392;
end.
const
  BASS_SAMPLE_LOOP = 4;
var
mp3Name: string;
mp3Handle: HWND;
 
function BASS_Init(device: Integer; freq, flags: DWORD; win: hwnd; CLSID: Integer): Boolean;
  external 'BASS_Init@files:BASS.dll stdcall delayload';
 
function BASS_StreamCreateFile(mem: BOOL; f: PChar; offset: DWORD; length: DWORD; flags: DWORD): DWORD;
  external 'BASS_StreamCreateFile@files:BASS.dll stdcall delayload';
 
function BASS_Start(): Boolean;
  external 'BASS_Start@files:BASS.dll stdcall delayload';
 
function BASS_ChannelPlay(handle: DWORD; restart: BOOL): Boolean;
  external 'BASS_ChannelPlay@files:BASS.dll stdcall delayload';
 
function BASS_ChannelIsActive(handle: DWORD): Integer;
  external 'BASS_ChannelIsActive@files:BASS.dll stdcall delayload';
 
function BASS_ChannelPause(handle: DWORD): Boolean;
  external 'BASS_ChannelPause@files:BASS.dll stdcall delayload';
 
function BASS_Stop(): Boolean;
  external 'BASS_Stop@files:BASS.dll stdcall delayload';
 
function BASS_Pause(): Boolean;
  external 'BASS_Pause@files:BASS.dll stdcall delayload';
 
function BASS_Free(): Boolean;
  external 'BASS_Free@files:BASS.dll stdcall delayload';
 
procedure CurPageChanged(CurPageID: Integer);
begin
  if CurPageID = InfoPage.ID then UpdateInfo()  // Обновление информации о системе
end;
 
function InitializeSetup(): Boolean;
begin
  ExtractTemporaryFile('BASS.dll');
  ExtractTemporaryFile('sound.mp3');
  mp3Name := ExpandConstant('{tmp}\sound.mp3');
  BASS_Init(-1, 44100, 0, 0, 0);
  mp3Handle := BASS_StreamCreateFile(FALSE, PChar(mp3Name), 0, 0, BASS_SAMPLE_LOOP);
  BASS_Start();
  BASS_ChannelPlay(mp3Handle, False);
  Result := True;
end;
 
procedure DeinitializeSetup();
begin
  BASS_Stop();
  BASS_Free();
end;
 
 
Procedure CurPageChanged(CurPageID: Integer);
begin
    if CurPageID=wpInstalling then begin
        WizardForm.STATUSLABEL.visible:=false;
        mt:=TNewStaticText.Create(WizardForm);
        with mt do begin
            Parent:=WizardForm;
            Left := ScaleX(40);
            Top := ScaleY(68);
            Width := ScaleX(77);
            Height := ScaleY(14);
            Caption := 'Идет установка:';
        end;
    end;
    if CurPageID=wpFinished then begin
        mt.free;
        mt:=nil;
    end;
end;
function ShowWindow(hWnd: LongWord; nCmdShow: LongWord): LongWord;
external 'ShowWindow@user32.dll stdcall';
 
[Run]
Filename: "{app}\iw4mp.exe"; Description: "{cm:LaunchProgram,игру}"; Flags: nowait postinstall skipifsilent
Filename: "{app}\launcher.exe"; Description: "{cm:LaunchProgram,лаунчер}"; Flags: nowait postinstall skipifsilent
Filename: "{app}\trainer.exe"; Description: "{cm:LaunchProgram,трейнер}"; Flags: nowait postinstall skipifsilent

Всего записей: 6 | Зарегистр. 25-07-2010 | Отправлено: 17:15 25-07-2010 | Исправлено: GDS666, 19:13 25-07-2010
   

На первую страницук этому сообщениюк последнему сообщению

Компьютерный форум Ru.Board » Компьютеры » Программы » Inno Setup (создание инсталяционных пакетов)
Widok (02-08-2010 12:04): Лимит страниц. Продолжаем здесь.


Реклама на форуме Ru.Board.

Powered by Ikonboard "v2.1.7b" © 2000 Ikonboard.com
Modified by Ru.B0ard
© Ru.B0ard 2000-2024

BitCoin: 1NGG1chHtUvrtEqjeerQCKDMUi6S6CG4iC

Рейтинг.ru