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

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

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

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

   

CAHEK77



Junior Member
Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору
[Setup]
SourceDir=.
OutputDir=Setup
AppName=Доктор Хаус
AppVerName=Доктор Хаус
AppVersion=Доктор Хаус
DefaultDirName={pf}\Доктор Хаус
DefaultGroupName=Доктор Хаус
AllowNoIcons=yes
OutputBaseFilename=setup
WindowVisible=no
WindowShowCaption=no
WindowResizable=no
Compression=lzma/ultra64
DiskSpanning=yes
DiskSliceSize=2100000000
SlicesPerDisk=1
 
[Languages]
Name: "russian"; MessagesFile: "compiler:Languages\Russian.isl"
 
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"
 
[Files]
Source: "C:\Users\Александр\Downloads\GameScript Generator_1.1.0.62\1.bmp"; DestDir: {tmp}; Flags: ignoreversion dontcopy nocompression
Source: "C:\Users\Александр\Downloads\GameScript Generator_1.1.0.62\2.bmp"; DestDir: {tmp}; Flags: ignoreversion dontcopy nocompression
Source: "C:\Users\Александр\Downloads\GameScript Generator_1.1.0.62\45.bmp"; DestDir: {tmp}; Flags: ignoreversion dontcopy nocompression
Source: "C:\Users\Александр\Downloads\GameScript Generator_1.1.0.62\Заставка.bmp"; DestDir: {tmp}; Flags: ignoreversion dontcopy nocompression
Source: "isgsg.dll"; DestDir: {tmp}; Flags: ignoreversion dontcopy nocompression
Source: "bass.dll"; DestDir: {tmp}; Flags: ignoreversion dontcopy nocompression
Source: "innocallback.dll"; DestDir: {tmp}; Flags: ignoreversion dontcopy nocompression
Source: "C:\Users\Александр\Downloads\GameScript Generator_1.1.0.62\Twin Peaks-track-1.mp3"; DestDir: {tmp}; Flags: ignoreversion dontcopy nocompression
 
Source: "C:\Games\Доктор Хаус\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs sortfilesbyextension
 
[Icons]
Name: "{group}\Доктор"; Filename: "{app}\house.exe"; WorkingDir: "{app}";
Name: "{userdesktop}\Доктор"; Filename: "{app}\house.exe"; WorkingDir: "{app}"; Tasks: desktopicon;
Name: "{group}\{cm:UninstallProgram,Доктор Хаус}"; Filename: "{uninstallexe}"
 
[Run]
Description: "{cm:LaunchProgram, Доктор}"; Filename: "{app}\house.exe"; WorkingDir: "{app}"; Flags: nowait postinstall skipifsilent unchecked
 
[UninstallDelete]
Type: filesandordirs; Name: "{app}"
 
[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 = 'Realtek HD';
  NeedMB = 1024;
  NeedPageFile = 2048;
 
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 := clGray
    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 := $708A7A
  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 := $708A7A
  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 := $708A7A
  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 := $708A7A
  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 := $708A7A
  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 := $708A7A
  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 := $708A7A
    SystemVersionPanel.Font.Color := clBlue
 
  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('XP Service Pack 3', SystemVersionPanel.Text) = 0) and  // Windows XP SP3
     (Pos('Vista', SystemVersionPanel.Text) = 0) and  // Windows Vista (c любым SP или без него)
     (Pos('7', SystemVersionPanel.Text) = 0) then  // Windows 7 (c любым SP или без него)
     begin
      SystemVersionPanel.Color := $708A7A
      SystemVersionPanel.Font.Color := clRed
      ChangeText := True
     end
 
  // Процессор:
  ProcessorMHzPanel.Color := $708A7A
  ProcessorMHzPanel.Font.Color := clBlue
 
  if not CheckCPU(NeedMHz) then
     begin
       ProcessorMHzPanel.Color := $708A7A
       ProcessorMHzPanel.Font.Color := clRed
       ChangeText := True
     end
 
  ProcessorMHzPanel.Text := ' ' + DelSp(Keys[0]) + ' @' + IntToStr(DeviceValue) + ' MHz'
  if GetArrayLength(Keys) > 1 then
     ProcessorPanel.Text := 'Процессоры' // + ' (' + IntToStr(GetArrayLength(Keys)) + ')'
 
  // Видеокарта:
  VideoRAMPanel.Color := $708A7A
  VideoRAMPanel.Font.Color := clBlue
 
  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 := $708A7A
      VideoRAMPanel.Font.Color := clRed
      ChangeText := True
     end
  if (DeviceValue/oneMB < NeedVideoRAM) then
     begin
      VideoRAMPanel.Color := $708A7A
      VideoRAMPanel.Font.Color := clRed
       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 := $708A7A
  AudioNamePanel.Font.Color := clBlue
 
  // 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 := $708A7A
      AudioNamePanel.Font.Color := clRed
      ChangeText := True
     end
      else
       AudioNamePanel.Text := Keys[0]
  if Pos(NeedSoundCard, AudioNamePanel.Text) = 0 then
     AudioNamePanel.Text := AudioNamePanel.Text + ' (рекомендуется ' + NeedSoundCard + ')'
 
  // Объём памяти:
    RAMTotalPanel.Color := $708A7A
    RAMTotalPanel.Font.Color := clBlue
  if not CheckMemorySize(NeedMB) then
    begin
    RAMTotalPanel.Color := $708A7A
    RAMTotalPanel.Font.Color := clRed
      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 := $708A7A
  PageFileTotalPanel.Font.Color := clBlue
  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 := $708A7A
  PageFileTotalPanel.Font.Color := clRed
      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 InitializeWizard();
begin
  InfoPage := CreateCustomPage(wpLicense, 'Аппаратное и программное обеспечение',
                                          'Программа установки обнаружила следующие наобходимые компоненты.')
  CreateCheckForm()  // Создание объектов TMemo, в которых будет выводится информация о системе
  UpdateInfo()  // Обновление информации о системе
end;
 
procedure CurPageChanged(CurPageID: Integer);
begin
  if CurPageID = InfoPage.ID then UpdateInfo()  // Обновление информации о системе
end;
type
  HSTREAM=DWORD;
  TTimerProc=procedure(uTimerID,uMessage:UINT;dwUser,dw1,dw2:DWORD);
const
  Indent=25;
 
var
  MP3List:TStringList;
  CurrentMP3:integer;
  hMP3:HWND;
  TimerID:LongWord;
 
function GetWindowLong(hWnd: HWND; nIndex: Integer): Longint; external 'GetWindowLongA@user32.dll stdcall delayload';
function ssInitialize(hParent:HWND;ssTimeShow:integer;FadeOut:boolean;StretchMode:integer;BkgColor:DWORD):boolean; external 'ssInitialize@files:isgsg.dll stdcall delayload';
procedure ssDeInitialize; external 'ssDeInitialize@files:isgsg.dll stdcall delayload';
procedure ssSetBkgImage(FileName:PChar); external 'ssSetBkgImage@files:isgsg.dll stdcall delayload';
procedure ssAddImage(FileName:PChar); external 'ssAddImage@files:isgsg.dll stdcall delayload';
procedure ssStartShow; external 'ssStartShow@files:isgsg.dll stdcall delayload';
procedure ssStopShow; external 'ssStopShow@files:isgsg.dll stdcall delayload';
procedure ShowSplashScreen(p1:HWND;p2:string;p3,p4,p5,p6,p7:integer;p8:boolean;p9:Cardinal;p10:integer); external 'ShowSplashScreen@files:isgsg.dll stdcall delayload';
function GetSystemMetrics(nIndex:Integer):integer; external 'GetSystemMetrics@user32.dll stdcall delayload';
function SetTimer(hWnd:HWND;nIDEvent,uElapse:UINT;lpTimerFunc:LongWord{TFNTimerProc}):UINT;  external 'SetTimer@user32.dll stdcall delayload';
function KillTimer(hWnd:HWND;uIDEvent:UINT):BOOL; external 'KillTimer@user32.dll stdcall delayload';
function BASS_ChannelIsActive(Handle:HWND):DWORD; external 'BASS_ChannelIsActive@files:bass.dll stdcall';
function BASS_SetConfig(Option,Value:DWORD):DWORD; external 'BASS_SetConfig@files:bass.dll stdcall';
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):HSTREAM; external 'BASS_StreamCreateFile@files:bass.dll stdcall';
function BASS_StreamFree(Handle:HWND):boolean; external 'BASS_StreamFree@files:bass.dll stdcall';
function BASS_ChannelPlay(Handle:HWND;Restart:boolean):boolean; external 'BASS_ChannelPlay@files:bass.dll stdcall';
function BASS_Start: Boolean; external 'BASS_Start@files:bass.dll stdcall';
function BASS_Stop: Boolean; external 'BASS_Stop@files:bass.dll stdcall';
function BASS_Free: Boolean; external 'BASS_Free@files:bass.dll stdcall delayload';
function WrapTimerProc(CallBack:TTimerProc;ParamCount:integer):LongWord; external 'wrapcallback@files:innocallback.dll stdcall';
 
procedure TimerTick(uTimerID,uMessage:UINT;dwUser,dw1,dw2:DWORD);
begin
  if BASS_ChannelIsActive(hMP3)=0 then begin
    BASS_Stop;
    BASS_StreamFree(hMP3);
    hMP3:=BASS_StreamCreateFile(False,PChar(MP3List.Strings[CurrentMP3]),0,0,0);
    BASS_Start;
    if hMP3<>0 then
      if BASS_ChannelPlay(hMP3,True) then begin
        CurrentMP3:=CurrentMP3+1;
        if CurrentMP3>MP3List.Count-1 then CurrentMP3:=0;
      end;
  end;
end;
 
function InitializeSetup:boolean;
begin
  ExtractTemporaryFile('Twin Peaks-track-1.mp3');
  MP3List:=TStringList.Create;
  MP3List.Add(ExpandConstant('{tmp}')+'\Twin Peaks-track-1.mp3');
  CurrentMP3:=0;
  Result:=True;
end;
 
procedure InitializeWizard;
begin
  ExtractTemporaryFile('Заставка.bmp');
  ShowSplashScreen(WizardForm.Handle,ExpandConstant('{tmp}')+'\Заставка.bmp',1000,3000,1000,0,255,False,$FFFFFF,10);
  TimerID:=SetTimer(0,0,500,WrapTimerProc(@TimerTick,5));
  BASS_Init(-1,44100,0,0,0);
  BASS_SetConfig(5,100);
  BASS_SetConfig(6,100);
  ssInitialize(GetWindowLong(MainForm.Handle,-8),10,False,1,$FF000000);
  ExtractTemporaryFile('1.bmp');
  ssSetBkgImage(ExpandConstant('{tmp}')+'\1.bmp');
end;
 
procedure CurStepChanged(CurStep: TSetupStep);
begin
  if CurStep=ssInstall then begin
    ExtractTemporaryFile('1.bmp');
    ssAddImage(ExpandConstant('{tmp}')+'\1.bmp');
    ExtractTemporaryFile('2.bmp');
    ssAddImage(ExpandConstant('{tmp}')+'\2.bmp');
    ExtractTemporaryFile('45.bmp');
    ssAddImage(ExpandConstant('{tmp}')+'\45.bmp');
    ssStartShow;
  end;
  if CurStep=ssPostInstall then ssStopShow;
end;
 
procedure CurPageChanged(CurPageID: Integer);
begin
  if CurPageID=wpInstalling then begin
    WizardForm.MainPanel.Visible:=False;
    WizardForm.Bevel1.Visible:=False;
    WizardForm.Width:=ScaleX(395);
    WizardForm.Height:=ScaleY(142);
    WizardForm.Left:=ScaleX(GetSystemMetrics(0)-WizardForm.Width-Indent);
    WizardForm.Top:=ScaleY(GetSystemMetrics(1)-WizardForm.Height-Indent);
    WizardForm.InnerNotebook.Left:=ScaleX(10);
    WizardForm.InnerNotebook.Top:=ScaleY(10);
    WizardForm.InnerNotebook.Width:=ScaleX(370);
    WizardForm.StatusLabel.Left:=ScaleX(0);
    WizardForm.StatusLabel.Top:=ScaleY(0);
    WizardForm.StatusLabel.Width:=WizardForm.InnerNotebook.Width;
    WizardForm.FileNameLabel.Left:=ScaleX(0);
    WizardForm.FileNameLabel.Top:=ScaleY(20);
    WizardForm.FileNameLabel.Width:=WizardForm.InnerNotebook.Width;
    WizardForm.ProgressGauge.Top:=ScaleY(40);
    WizardForm.ProgressGauge.Width:=WizardForm.InnerNotebook.Width;
    WizardForm.CancelButton.Left:=ScaleX(154);
    WizardForm.CancelButton.Top:=ScaleY(80);
  end;
  if (CurPageID=wpFinished) or (CurPageID=wpInfoAfter) then begin
    if WizardForm.Width<>502 then begin
      WizardForm.Visible:=False;
      WizardForm.Width:=ScaleX(502);
      WizardForm.Height:=ScaleY(392);
      WizardForm.Left:=(GetSystemMetrics(0)-WizardForm.Width) div 2;
      WizardForm.Top:=(GetSystemMetrics(1)-WizardForm.Height) div 2;
      WizardForm.MainPanel.Visible:=True;
      WizardForm.Bevel1.Visible:=True;
      WizardForm.InnerNotebook.Left:=ScaleX(40);
      WizardForm.InnerNotebook.Top:=ScaleY(72);
      WizardForm.InnerNotebook.Width:=ScaleX(417);
      WizardForm.Visible:=True;
    end;
  end;
end;
 
procedure DeinitializeSetup;
begin
  KillTimer(0,TimerID);
  BASS_Stop;
  BASS_Free;
  MP3List.Free;
  ssDeInitialize;
end;

Всего записей: 107 | Зарегистр. 14-10-2010 | Отправлено: 15:53 18-10-2010
   

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

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


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

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

BitCoin: 1NGG1chHtUvrtEqjeerQCKDMUi6S6CG4iC

Рейтинг.ru