PSKOVMAIL
 
  
  Newbie | Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору Круче чем S.T.A.L.K.E.R. :      [Setup]   AppName=My Program   AppVerName=My Program 1.5   AppPublisher=My Company, Inc.   AppPublisherURL=http://www.example.com/   AppSupportURL=http://www.example.com/   AppUpdatesURL=http://www.example.com/   DefaultDirName={pf}\My Program   DefaultGroupName=My Program   OutputBaseFilename=setup   Compression=lzma   SolidCompression=yes      [Languages]   Name: english; MessagesFile: compiler:Default.isl      [Files]   Source: C:\Program Files\Inno Setup 5\Examples\MyProg.exe; DestDir: {app}; Flags: ignoreversion   Source: C:\Program Files\Inno Setup Complect\get_hw_caps.dll; DestDir: {tmp}; Flags: dontcopy      [Code]   function GetVideoCardName(): PChar;   external 'hwc_GetVideoCardName@files:get_hw_caps.dll stdcall';      function GetSoundCardName(): PChar;   external 'hwc_GetSoundCardName@files:get_hw_caps.dll stdcall';      function GetSystemPage(): Integer;   external 'hwc_GetSystemPage@files:get_hw_caps.dll stdcall';      function GetSystemPhys(): Integer;   external 'hwc_GetSystemPhys@files:get_hw_caps.dll stdcall';      function GetHardDriveFreeSpace(hdd: integer): Integer;   external 'hwc_GetHardDriveFreeSpace@files:get_hw_caps.dll stdcall';      function GetHardDriveTotalSpace(hdd: integer): Integer;   external 'hwc_GetHardDriveTotalSpace@files:get_hw_caps.dll stdcall';      function GetHardDriveName(hdd: integer): PChar;   external 'hwc_GetHardDriveName@files:get_hw_caps.dll stdcall';      function DetectHardware(): Integer;   external 'hwc_DetectHardware@files:get_hw_caps.dll stdcall';         function CustomForm_CreatePage(PreviousPageId: Integer): Integer;   var     Page: TWizardPage;     Panel1: TPanel;     Panel2: TPanel;     Panel4: TPanel;     Panel3: TPanel;     Panel5: TPanel;     Panel6: TPanel;     Panel7: TPanel;     Panel8: TPanel;     Panel9: TPanel;     Panel10: TPanel;     Panel11: TPanel;     Panel12: TPanel;     Panel13: TPanel;   begin     Page := CreateCustomPage(wpWelcome, ExpandConstant('Аппаратное обеспечение'),  ExpandConstant('Программа установки обнаружила следующие необходимые компоненты'));   { Panel1 }   Panel1 := TPanel.Create(Page);   with Panel1 do   begin     Parent := Page.Surface;     Caption := ExpandConstant('Звуковая карта');     Left := ScaleX(24);     Top := ScaleY(136);     Width := ScaleX(134);     Height := ScaleY(25);     BorderStyle := bsSingle;     Font.Name := 'Tahoma';     Font.Style := [fsBold];     Color := 15793151;     TabOrder := 0;   end;      { Panel2 }   Panel2 := TPanel.Create(Page);   with Panel2 do   begin     Parent := Page.Surface;     Caption := 'Свободно диска С:';     Left := ScaleX(24);     Top := ScaleY(168);     Width := ScaleX(134);     Height := ScaleY(25);     BorderStyle := bsSingle;     Font.Name := 'Tahoma';     Font.Style := [fsBold];     Color := 15793151;     TabOrder := 1;   end;      { Panel4 }   Panel4 := TPanel.Create(Page);   with Panel4 do   begin     Parent := Page.Surface;     Caption := 'Всего на диске C:';     Left := ScaleX(24);     Top := ScaleY(200);     Width := ScaleX(134);     Height := ScaleY(25);     BorderStyle := bsSingle;     Font.Name := 'Tahoma';     Font.Style := [fsBold];     Color := 15793151;     TabOrder := 2;   end;      { Panel3 }   Panel3 := TPanel.Create(Page);   with Panel3 do   begin     Parent := Page.Surface;     Caption := ExpandConstant('Видеоадаптер');     Left := ScaleX(24);     Top := ScaleY(104);     Width := ScaleX(134);     Height := ScaleY(25);     BorderStyle := bsSingle;     Font.Name := 'Tahoma';     Font.Style := [fsBold];     Color := 15793151;     TabOrder := 3;   end;      { Panel5 }   Panel5 := TPanel.Create(Page);   with Panel5 do   begin     Parent := Page.Surface;     Caption := ExpandConstant('ОЗУ');     Left := ScaleX(24);     Top := ScaleY(72);     Width := ScaleX(134);     Height := ScaleY(25);     BorderStyle := bsSingle;     Font.Name := 'Tahoma';     Font.Style := [fsBold];     Color := 15793151;     TabOrder := 4;   end;      { Panel6 }   Panel6 := TPanel.Create(Page);   with Panel6 do   begin     Parent := Page.Surface;     Caption := ExpandConstant('Процессор');     Left := ScaleX(24);     Top := ScaleY(40);     Width := ScaleX(134);     Height := ScaleY(25);     BorderStyle := bsSingle;     Font.Name := 'Tahoma';     Font.Style := [fsBold];     Color := 15793151;     TabOrder := 5;   end;      { Panel7 }   Panel7 := TPanel.Create(Page);   with Panel7 do   begin     Parent := Page.Surface;     Caption := '' + IntToStr(GetHardDriveFreeSpace(0))+ 'Mb';     Left := ScaleX(176);     Top := ScaleY(168);     Width := ScaleX(225);     Height := ScaleY(25);     BorderStyle := bsSingle;     Font.Name := 'Tahoma';     Font.Style := [fsBold, fsItalic];     Color := 15780518;     TabOrder := 6;   end;      { Panel8 }   Panel8 := TPanel.Create(Page);   with Panel8 do   begin     Parent := Page.Surface;     Caption := '' + IntToStr(GetSystemPhys()) + 'Mb';     Left := ScaleX(176);     Top := ScaleY(72);     Width := ScaleX(225);     Height := ScaleY(25);     BorderStyle := bsSingle;     Font.Name := 'Tahoma';     Font.Style := [fsBold, fsItalic];     Color := 15780518;     TabOrder := 7;   end;      { Panel9 }   Panel9 := TPanel.Create(Page);   with Panel9 do   begin     Parent := Page.Surface;     Caption := ''+ GetVideoCardName;     Left := ScaleX(176);     Top := ScaleY(104);     Width := ScaleX(225);     Height := ScaleY(25);     BorderStyle := bsSingle;     Font.Name := 'Tahoma';     Font.Style := [fsBold, fsItalic];     Color := 15780518;     TabOrder := 8;   end;      { Panel10 }   Panel10 := TPanel.Create(Page);   with Panel10 do   begin     Parent := Panel9;     Caption := '' + IntToStr(GetHardDriveFreeSpace(0))+ 'Mb';     Left := ScaleX(176);     Top := ScaleY(40);     Width := ScaleX(225);     Height := ScaleY(25);     Font.Name := 'Tahoma';     Font.Style := [fsBold, fsItalic];     Color := 15780518;     TabOrder := 0;   end;      { Panel11 }   Panel11 := TPanel.Create(Page);   with Panel11 do   begin     Parent := Page.Surface;     Caption := ''+ GetSoundCardName;     Left := ScaleX(176);     Top := ScaleY(136);     Width := ScaleX(225);     Height := ScaleY(25);     BorderStyle := bsSingle;     Font.Name := 'Tahoma';     Font.Style := [fsBold, fsItalic];     Color := 15780518;     TabOrder := 9;   end;      { Panel12 }   Panel12 := TPanel.Create(Page);   with Panel12 do   begin     Parent := Page.Surface;     Caption := ExpandConstant('{reg:HKLM\HARDWARE\DESCRIPTION\System\CentralProcessor\0,ProcessorNameString|}');     Left := ScaleX(176);     Top := ScaleY(40);     Width := ScaleX(225);     Height := ScaleY(25);     BorderStyle := bsSingle;     Font.Name := 'Tahoma';     Font.Style := [fsBold, fsItalic];     Color := 15780518;     TabOrder := 10;   end;      { Panel13 }   Panel13 := TPanel.Create(Page);   with Panel13 do   begin     Parent := Page.Surface;     Caption := '' + IntToStr(GetHardDriveTotalSpace(0))+'Mb';     Left := ScaleX(176);     Top := ScaleY(200);     Width := ScaleX(225);     Height := ScaleY(25);     BorderStyle := bsSingle;     Font.Name := 'Tahoma';     Font.Style := [fsBold, fsItalic];     Color := 15780518;     TabOrder := 11;   end;   end;      const     NeedSize = 50; //Прописать, сколько мегабайт необходимо        DRIVE_UNKNOWN = 0;     DRIVE_NO_ROOT_DIR = 1;     DRIVE_REMOVEABLE = 2;     DRIVE_FIXED = 3;     DRIVE_REMOTE = 4;     DRIVE_CDROM = 5;     DRIVE_RAMDISK = 6;      var     ListBox: TListBox;      function GetLogicalDrives: DWORD;   external 'GetLogicalDrives@kernel32.dll stdcall';      function GetDriveType(nDrive: String): Longint;   external 'GetDriveTypeA@kernel32.dll stdcall';      procedure ListBoxOnClick(Sender: TObject);   var     NewLetter, OldString: String;     i: Integer;   begin     for i:= 0 to ListBox.Items.Count-1 do       begin         if ListBox.Selected[i] then           begin             NewLetter:= Copy(ListBox.Items[i], 0, 1);             OldString:= Copy(WizardForm.DirEdit.Text, 2, Length(WizardForm.DirEdit.Text));             WizardForm.DirEdit.Text:= NewLetter + OldString;           end;       end;   end;      procedure InitializeWizard();   var     Path: String;     FreeMB, TotalMB: Cardinal;     drives: DWORD;     i: integer;   begin     CustomForm_CreatePage(wpWelcome);     ListBox:= TListBox.Create(WizardForm);     ListBox.Top:= 120;     ListBox.Width:= 300;     ListBox.Height:= ScaleY(90);     ListBox.Parent:= WizardForm.SelectDirPage;     ListBox.OnClick:= @ListBoxOnClick;        drives:= GetLogicalDrives();     for i:= 0 to 31 do        begin           if (drives and (1 shl i)) > 0 then               begin                 Path:= chr(ord('A')+i)+':';                 if GetDriveType(Path) = DRIVE_FIXED then                   begin                     GetSpaceOnDisk(Path, True, FreeMB, TotalMB);                     ListBox.Items.Add(Path + ' - Всего: ' + IntToStr(TotalMB) +                                    'Мб - Свободно: ' + IntToStr(FreeMB) + 'Мб');                   end;               end;        end;   end;      function NextButtonClick(CurPageID: Integer): Boolean;   var     Path: String;     FreeMB, TotalMB: Cardinal;   begin     Result:= True;     if CurPageID = wpSelectDir then       begin         Path:= ExtractFileDrive(WizardForm.DirEdit.Text);         GetSpaceOnDisk(Path, True, FreeMB, TotalMB);         if FreeMB < NeedSize then           begin             MsgBox('Недостаточно места на диске!', mbInformation, MB_OK)             Result:= False;           end;       end;   end;    |