Показать полную графическую версию : [архив] Inno Setup .:[все вопросы]:.
Raf-9600
30-05-2009, 23:26
SkynetAst, Сорь что опять встряваю, но чтоб не допускать вашей предыдущей ошибки в дальнейшем, достаточно просто изучить мануал к Inno Setup, тем более что есть его русская версия.
SkynetAst
30-05-2009, 23:27
Raf-9600,
Русская, расширенная от Restools ???
Raf-9600
30-05-2009, 23:31
SkynetAst, ну ли есть такая, не в курсе. Для начала подойдет и от обычной версии. В шапке есть на неё ссылки.
Raf-9600
30-05-2009, 23:49
Сорь за офтоп, но ктонить может подсказать команду чтоб через батник удалить все файлы в формате ".wav", находящиеся в папке "Sound" и всех её подпапках?
BlackSelf
31-05-2009, 00:00
Raf-9600, вот, пробуй.
"Слайдшоу на странице wpInstalling по таймеру". Автор: Rexsniper, я доработал.
#define TIME_FOR_VIEW 5
[Setup]
AppName=My Program
AppVerName=My Program v 1.5
DefaultDirName={pf}\My Program
OutputDir=.
Compression=none
SolidCompression=yes
[Languages]
Name: russian; MessagesFile: compiler:Languages\Russian.isl
[Files]
Source: compiler:get_hw_caps.dll; DestDir: {tmp}; Flags: dontcopy
Source: compiler:InnoCallback.dll; DestDir: {tmp}; Flags: ignoreversion dontcopy noencryption nocompression solidbreak
Source: Image_1.bmp; DestDir: {tmp}; Flags: ignoreversion dontcopy noencryption nocompression solidbreak
Source: Image_2.bmp; DestDir: {tmp}; Flags: ignoreversion dontcopy noencryption nocompression solidbreak
Source: Image_3.bmp; DestDir: {tmp}; Flags: ignoreversion dontcopy noencryption nocompression solidbreak
Source: Image_4.bmp; DestDir: {tmp}; Flags: ignoreversion dontcopy noencryption nocompression solidbreak
Source: Image_5.bmp; DestDir: {tmp}; Flags: ignoreversion dontcopy noencryption nocompression solidbreak
Source: Image_6.bmp; DestDir: {tmp}; Flags: ignoreversion dontcopy noencryption nocompression solidbreak
Source: Image_7.bmp; DestDir: {tmp}; Flags: ignoreversion dontcopy noencryption nocompression solidbreak
Source: Image_8.bmp; DestDir: {tmp}; Flags: ignoreversion dontcopy noencryption nocompression solidbreak
Source: Image_9.bmp; DestDir: {tmp}; Flags: ignoreversion dontcopy noencryption nocompression solidbreak
Source: Image_10.bmp; DestDir: {tmp}; Flags: ignoreversion dontcopy noencryption nocompression solidbreak
[_Code]
var
TimerID: LongWord;
currTime: Integer;
SplashImage: TBitmapImage;
type
TProc = procedure(HandleW, msg, idEvent, TimeSys: LongWord);
function WrapTimerProc(callback:TProc; paramcount:integer):longword;
external 'wrapcallback@files:InnoCallback.dll stdcall';
function SetTimer(hWnd: LongWord; nIDEvent, uElapse: LongWord; lpTimerFunc: LongWord): LongWord;
external 'SetTimer@user32.dll stdcall';
function KillTimer(hWnd: LongWord; nIDEvent: LongWord): LongWord;
external 'KillTimer@user32.dll stdcall';
procedure OnTimer(HandleW, msg, idEvent, TimeSys: LongWord);
begin
currTime := currTime + 1;
case currTime of
{#TIME_FOR_VIEW}: begin SplashImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\Image_2.bmp')) end;
2*{#TIME_FOR_VIEW}: begin SplashImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\Image_3.bmp')) end;
3*{#TIME_FOR_VIEW}: begin SplashImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\Image_4.bmp')) end;
4*{#TIME_FOR_VIEW}: begin SplashImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\Image_5.bmp')) end;
5*{#TIME_FOR_VIEW}: begin SplashImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\Image_6.bmp')) end;
6*{#TIME_FOR_VIEW}: begin SplashImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\Image_7.bmp')) end;
7*{#TIME_FOR_VIEW}: begin SplashImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\Image_8.bmp')) end;
8*{#TIME_FOR_VIEW}: begin SplashImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\Image_9.bmp')) end;
9*{#TIME_FOR_VIEW}: begin SplashImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\Image_10.bmp'))end;
end;
if CurrTime = 9*{#TIME_FOR_VIEW} then CurrTime := -1;
end;
procedure InitializeWizard;
begin
ExtractTemporaryFile('Image_1.bmp');
ExtractTemporaryFile('Image_2.bmp');
ExtractTemporaryFile('Image_3.bmp');
ExtractTemporaryFile('Image_4.bmp');
ExtractTemporaryFile('Image_5.bmp');
ExtractTemporaryFile('Image_6.bmp');
ExtractTemporaryFile('Image_7.bmp');
ExtractTemporaryFile('Image_8.bmp');
ExtractTemporaryFile('Image_9.bmp');
ExtractTemporaryFile('Image_10.bmp');
currTime := 0;
WizardForm.ProgressGauge.Parent := WizardForm;
WizardForm.ProgressGauge.Top := WizardForm.CancelButton.Top + ScaleY(10);
WizardForm.ProgressGauge.Left := ScaleX(10);
WizardForm.ProgressGauge.Width := WizardForm.MainPanel.Width - ScaleX(20);
WizardForm.ProgressGauge.Height := 16;
WizardForm.ProgressGauge.Hide;
WizardForm.StatusLabel.Parent := WizardForm;
WizardForm.StatusLabel.Left := ScaleX(10);
WizardForm.StatusLabel.Width := WizardForm.ProgressGauge.Width;
WizardForm.StatusLabel.Top := WizardForm.ProgressGauge.Top - ScaleY(18);
WizardForm.StatusLabel.Hide;
SplashImage := TBitmapImage.Create(WizardForm);
SplashImage.Top := 0;
SplashImage.Left := 0;
SplashImage.Width := WizardForm.MainPanel.Width;
SplashImage.Height := WizardForm.Bevel.Top;
SplashImage.Parent := WizardForm.InnerPage;
SplashImage.Stretch := True;
SplashImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\Image_1.bmp'));
SplashImage.Hide;
end;
procedure CurPageChanged(CurPageID: Integer);
var
pfunc: LongWord;
begin
if (CurPageID = wpInstalling) then
begin
pfunc := WrapTimerProc(@OnTimer, 5);
TimerID := SetTimer(0, 0, 1000, pfunc);
WizardForm.PageNameLabel.Visible:=false
WizardForm.PageDescriptionLabel.Visible:=false
WizardForm.InnerNotebook.Hide;
WizardForm.Bevel1.Hide;
WizardForm.MainPanel.Hide;
WizardForm.PageNameLabel.Hide;
WizardForm.PageDescriptionLabel.Hide;
WizardForm.ProgressGauge.Show;
WizardForm.StatusLabel.Show;
SplashImage.Show;
WizardForm.CancelButton.hide
end
else
begin
WizardForm.ProgressGauge.Hide;
WizardForm.StatusLabel.Hide;
SplashImage.Hide;
if (CurPageID > wpInstalling) and (CurPageID < wpFinished) then
begin
WizardForm.InnerNotebook.Show;
WizardForm.Bevel1.Show;
WizardForm.MainPanel.Show;
WizardForm.PageNameLabel.Show;
WizardForm.PageDescriptionLabel.Show;
end
If CurPageID=wpFinished then
end;
end;
procedure DeInitializeSetup();
begin
KillTimer(0, TimerID);
end;
Raf-9600
31-05-2009, 00:11
BlackSelf, а get_hw_caps.dll и InnoCallback.dll можете куданить залить?
BlackSelf
31-05-2009, 00:13
Raf-9600, http://narod.ru/disk/9309585000/dll.rar.html
Лично мне хотелось бы заиметь оба варианта. »
Видео, сразу скажу даже ни разу не делал, не знаю, а смена картинок - можно, но где-то на предыдущих страницах, я уже писал такой код... там происходит смена картинок и прогрессбар именно снизу.
что можете из литературы посоветовать учебной чтобы вникать в суть? »
Справка к Inno Setup, а если есть желание изучить глубже, то нужна литература по Делфи. Я создавал тему по Делфи (http://www.forum.oszone.ru/thread-130793.html) и в шапке, много очень полезной литературы.
Русская, расширенная от Restools ??? »
Справки к Restools, просто не может быть, потому, что она на основе стандартного Inno Setup, но заточенная под Делфи...
Если вам будет проще, то в шапке этой темы есть - InnoCompiler090319_Russian - Русский перевод (80%) от tem000.
что нужно прописать, чтоб через батник удалить все файлы в формате ".wav", находящиеся в папке "Sound" и всех её подпапках? »
Вопрос не для этой темы, но надо написать так:
del Sound\*.wav
Raf-9600
31-05-2009, 00:33
BlackSelf, Выглядит мега круто! Даже красивее чем на сканах http://pirat.ca/forum/images/smiles/good.gif
Смущает только то что кнопка "закрыть" совершенно не работает. Т.е. во время инсталляции, она не может отменить её.
Ну и ещё хотелось бы вариант в котором бы отображался какой файл на данный момент распаковываться.
Также интересует, возможно ли какнить сделать так, чтобы вместо BMP можно было туда вставлять JPG картинки? Это ускорило б запуск инсталлятора, и позволило б добавить значительно больше слайдов.
Видео, сразу скажу даже ни разу не делал »
Я имел веду одну версию со слайд-шоу по времени, а вторую со слайд-шоу в зависимости от того, сколько % установлено.
ИМХО Видео туда пихать непрактично, вот протестировал, и запихнул картинок, сумарным объемом в 63,0 МБ, и это ЗНАЧИТЕЛЬНО повлияло на скорость запуска инсталлятора.
Вопрос не для этой темы, но надо написать так: »
Та знаю... Но "del Sound\*.wav", если не ошибаюсь, удалит только wav из папки Sound, а мне нужно ещё и из всех её подпапок.
если не ошибаюсь, удалит только wav из папки Sound, а мне нужно ещё и из всех её подпапок. »
Да, извините, надо так:
del /s Sound\*.wav
BlackSelf
31-05-2009, 01:28
Raf-9600, код с отображением путей и активной кнопкой "отмена".
#define TIME_FOR_VIEW 5
[Setup]
AppName=My Program
AppVerName=My Program v 1.5
DefaultDirName={pf}\My Program
OutputDir=.
Compression=none
SolidCompression=yes
[Languages]
Name: russian; MessagesFile: compiler:Languages\Russian.isl
[Files]
Source: compiler:get_hw_caps.dll; DestDir: {tmp}; Flags: dontcopy
Source: compiler:InnoCallback.dll; DestDir: {tmp}; Flags: ignoreversion dontcopy noencryption nocompression solidbreak
Source: F:\ISSkin\TR\Slide_Img\Image_1.bmp; DestDir: {tmp}; Flags: ignoreversion dontcopy noencryption nocompression solidbreak
Source: F:\ISSkin\TR\Slide_Img\Image_2.bmp; DestDir: {tmp}; Flags: ignoreversion dontcopy noencryption nocompression solidbreak
Source: F:\ISSkin\TR\Slide_Img\Image_3.bmp; DestDir: {tmp}; Flags: ignoreversion dontcopy noencryption nocompression solidbreak
Source: F:\ISSkin\TR\Slide_Img\Image_4.bmp; DestDir: {tmp}; Flags: ignoreversion dontcopy noencryption nocompression solidbreak
Source: F:\ISSkin\TR\Slide_Img\Image_5.bmp; DestDir: {tmp}; Flags: ignoreversion dontcopy noencryption nocompression solidbreak
Source: F:\ISSkin\TR\Slide_Img\Image_6.bmp; DestDir: {tmp}; Flags: ignoreversion dontcopy noencryption nocompression solidbreak
Source: F:\ISSkin\TR\Slide_Img\Image_7.bmp; DestDir: {tmp}; Flags: ignoreversion dontcopy noencryption nocompression solidbreak
Source: F:\ISSkin\TR\Slide_Img\Image_8.bmp; DestDir: {tmp}; Flags: ignoreversion dontcopy noencryption nocompression solidbreak
Source: F:\ISSkin\TR\Slide_Img\Image_9.bmp; DestDir: {tmp}; Flags: ignoreversion dontcopy noencryption nocompression solidbreak
Source: F:\ISSkin\TR\Slide_Img\Image_10.bmp; DestDir: {tmp}; Flags: ignoreversion dontcopy noencryption nocompression solidbreak
[_Code]
var
TimerID: LongWord;
currTime: Integer;
SplashImage: TBitmapImage;
type
TProc = procedure(HandleW, msg, idEvent, TimeSys: LongWord);
function WrapTimerProc(callback:TProc; paramcount:integer):longword;
external 'wrapcallback@files:InnoCallback.dll stdcall';
function SetTimer(hWnd: LongWord; nIDEvent, uElapse: LongWord; lpTimerFunc: LongWord): LongWord;
external 'SetTimer@user32.dll stdcall';
function KillTimer(hWnd: LongWord; nIDEvent: LongWord): LongWord;
external 'KillTimer@user32.dll stdcall';
procedure OnTimer(HandleW, msg, idEvent, TimeSys: LongWord);
begin
currTime := currTime + 1;
case currTime of
{#TIME_FOR_VIEW}: begin SplashImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\Image_2.bmp')) end;
2*{#TIME_FOR_VIEW}: begin SplashImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\Image_3.bmp')) end;
3*{#TIME_FOR_VIEW}: begin SplashImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\Image_4.bmp')) end;
4*{#TIME_FOR_VIEW}: begin SplashImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\Image_5.bmp')) end;
5*{#TIME_FOR_VIEW}: begin SplashImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\Image_6.bmp')) end;
6*{#TIME_FOR_VIEW}: begin SplashImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\Image_7.bmp')) end;
7*{#TIME_FOR_VIEW}: begin SplashImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\Image_8.bmp')) end;
8*{#TIME_FOR_VIEW}: begin SplashImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\Image_9.bmp')) end;
9*{#TIME_FOR_VIEW}: begin SplashImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\Image_10.bmp'))end;
end;
if CurrTime = 9*{#TIME_FOR_VIEW} then CurrTime := -1;
end;
procedure InitializeWizard;
begin
ExtractTemporaryFile('Image_1.bmp');
ExtractTemporaryFile('Image_2.bmp');
ExtractTemporaryFile('Image_3.bmp');
ExtractTemporaryFile('Image_4.bmp');
ExtractTemporaryFile('Image_5.bmp');
ExtractTemporaryFile('Image_6.bmp');
ExtractTemporaryFile('Image_7.bmp');
ExtractTemporaryFile('Image_8.bmp');
ExtractTemporaryFile('Image_9.bmp');
ExtractTemporaryFile('Image_10.bmp');
currTime := 0;
WizardForm.ProgressGauge.Parent := WizardForm;
WizardForm.ProgressGauge.Top := WizardForm.CancelButton.Top + ScaleY(12);
WizardForm.ProgressGauge.Left := ScaleX(10);
WizardForm.ProgressGauge.Width := WizardForm.MainPanel.Width - ScaleX(20);
WizardForm.ProgressGauge.Height := 16;
WizardForm.ProgressGauge.Hide;
WizardForm.FileNameLabel.Parent := WizardForm;
WizardForm.FileNameLabel.Top := WizardForm.ProgressGauge.Top - ScaleY(18);
WizardForm.FileNameLabel.Left := ScaleX(10);
WizardForm.FileNameLabel.Width := ScaleX(397);
WizardForm.FileNameLabel.Hide;
SplashImage := TBitmapImage.Create(WizardForm);
SplashImage.Top := 0;
SplashImage.Left := 0;
SplashImage.Width := WizardForm.MainPanel.Width;
SplashImage.Height := WizardForm.Bevel.Top;
SplashImage.Parent := WizardForm.InnerPage;
SplashImage.Stretch := True;
SplashImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\Image_1.bmp'));
SplashImage.Hide;
end;
procedure CurPageChanged(CurPageID: Integer);
var
pfunc: LongWord;
begin
if (CurPageID = wpInstalling) then
begin
pfunc := WrapTimerProc(@OnTimer, 5);
TimerID := SetTimer(0, 0, 1000, pfunc);
WizardForm.PageNameLabel.Visible:=false
WizardForm.PageDescriptionLabel.Visible:=false
WizardForm.InnerNotebook.Hide;
WizardForm.Bevel1.Hide;
WizardForm.MainPanel.Hide;
WizardForm.PageNameLabel.Hide;
WizardForm.PageDescriptionLabel.Hide;
WizardForm.ProgressGauge.Show;
WizardForm.FileNameLabel.Show;
SplashImage.Show;
WizardForm.CancelButton.Enabled :=True
WizardForm.CancelButton.Top := WizardForm.Bevel.Top + ScaleY(2)
end
else
begin
WizardForm.ProgressGauge.Hide;
SplashImage.Hide;
WizardForm.FileNameLabel.Hide;
if (CurPageID > wpInstalling) and (CurPageID < wpFinished) then
begin
WizardForm.InnerNotebook.Show;
WizardForm.Bevel1.Show;
WizardForm.MainPanel.Show;
WizardForm.PageNameLabel.Show;
WizardForm.PageDescriptionLabel.Show;
end
If CurPageID=wpFinished then
end;
end;
procedure DeInitializeSetup();
begin
KillTimer(0, TimerID);
end;
А насчет *.jpg это надо через isxbb.dll делать.
SkynetAst
31-05-2009, 12:44
Вот возникло два вопроса:
1) То что вчера получилось отлично работает НО, при указании пути установки например D:\Games\Star 1.16 из - за пробела не идет распаковка архива, если писать любой другой путь но без пробелов все ставится, с пробелами не идет распаковка.
[Setup]
SourceDir=.
OutputDir=Setup
AppName=StarCraft
AppVerName=StarCraft
AppVersion=StarCraft
AppPublisher=Skynet
AppCopyright=Skynet
DefaultDirName={pf}\StarCraft
DefaultGroupName=StarCraft
AllowNoIcons=yes
OutputBaseFilename=starik
WindowVisible=no
WindowShowCaption=no
WindowResizable=no
Compression=lzma/fast
WizardImageFile=C:\Program Files\Smart Install Maker\Bitmaps\Import\Bmp014.bmp
WizardSmallImageFile=C:\Program Files\Smart Install Maker\Bitmaps\Import\Bmp015.bmp
[Languages]
Name: "russian"; MessagesFile: "compiler:Languages\Russian.isl"
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"
[Files]
Source: "isxbb.dll"; DestDir: {tmp}; Flags: ignoreversion dontcopy nocompression
Source: "C:\Users\Skynet\Desktop\starcraft.jpg"; DestDir: {tmp}; Flags: ignoreversion dontcopy nocompression
Source: "C:\Users\Skynet\Desktop\img_2862_starcraft-0002.jpg"; DestDir: {tmp}; Flags: ignoreversion dontcopy nocompression
Source: "C:\Users\Skynet\Desktop\1221340359_starcraft.front_cover.jpg"; 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: "D:\Music\blur_-_song2.mp3"; DestDir: {tmp}; Flags: ignoreversion dontcopy nocompression
Source: "E:\StarCraft\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs sortfilesbyextension
Source: E:\starcraft\arc.exe; DestDir: {app};
Source: E:\starcraft\starcraft.arc; DestDir: {app};
[Icons]
Name: "{group}\StarCraft"; Filename: "{app}\StarCraft.exe"; WorkingDir: "{app}";
Name: "{userdesktop}\StarCraft"; Filename: "{app}\StarCraft.exe"; WorkingDir: "{app}"; Tasks: desktopicon;
Name: "{group}\{cm:UninstallProgram,StarCraft}"; Filename: "{uninstallexe}"
[Run]
Filename: {app}\arc.exe; Parameters: x {app}\starcraft.arc -y -dp{app}; WorkingDir: {app}; Description: {cm:LaunchProgram, StarCraft}; StatusMsg: Идет распаковка... ;
Filename: {app}\StarCraft.exe; WorkingDir: {app}; Flags: nowait postinstall skipifsilent unchecked
[UninstallDelete]
Type: filesandordirs; Name: "{app}"
[_ISTool]
EnableISX=True
[Code]
type
HSTREAM=DWORD;
TTimerProc=procedure(uTimerID,uMessage:UINT;dwUser,dw1,dw2:DWORD);
const
BackGround=6;
Timer=16;
Indent=25;
var
MP3List:TStringList;
CurrentMP3:integer;
hMP3:HWND;
TimerID:LongWord;
function isxbb_AddImage(Image: PChar; Flags: Cardinal): integer; external 'isxbb_AddImage@files:isxbb.dll stdcall delayload';
function isxbb_Init(hWnd: Integer): integer; external 'isxbb_Init@files:isxbb.dll stdcall delayload';
function isxbb_StartTimer(Seconds: Integer; Flags: Cardinal): integer; external 'isxbb_StartTimer@files:isxbb.dll stdcall';
function isxbb_KillTimer(Flags: Cardinal): integer; external 'isxbb_KillTimer@files:isxbb.dll stdcall';
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('blur_-_song2.mp3');
MP3List:=TStringList.Create;
MP3List.Add(ExpandConstant('{tmp}')+'\blur_-_song2.mp3');
CurrentMP3:=0;
Result:=True;
end;
procedure InitializeWizard;
begin
WizardForm.Position:=poScreenCenter;
MainForm.BorderStyle:=bsNone;
MainForm.Width:=GetSystemMetrics(0);
MainForm.Height:=GetSystemMetrics(1)+1;
MainForm.Top:=-1;
MainForm.Left:=0;
ExtractTemporaryFile('1221340359_starcraft.front_cover.jpg');
ShowSplashScreen(WizardForm.Handle,ExpandConstant('{tmp}')+'\1221340359_starcraft.front_cover.jpg',1 000,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);
ExtractTemporaryFile('starcraft.jpg');
isxbb_AddImage(ExpandConstant('{tmp}')+'\starcraft.jpg',BackGround);
isxbb_Init(StrToInt(ExpandConstant('{hwnd}')));
MainForm.Visible:=True;
end;
procedure CurStepChanged(CurStep: TSetupStep);
begin
if CurStep=ssInstall then begin
ExtractTemporaryFile('img_2862_starcraft-0002.jpg');
isxbb_AddImage(ExpandConstant('{tmp}')+'\img_2862_starcraft-0002.jpg',BackGround or Timer);
isxbb_Init(StrToInt(ExpandConstant('{hwnd}')));
isxbb_StartTimer(4,BackGround)
end;
if CurStep=ssPostInstall then begin
isxbb_KillTimer(BackGround);
end;
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(MainForm.Width-WizardForm.Width-Indent);
WizardForm.Top:=ScaleY(MainForm.Height-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 then begin
WizardForm.Visible:=False;
WizardForm.Width:=502;
WizardForm.Height:=392;
WizardForm.Left:=(MainForm.Width-WizardForm.Width) div 2;
WizardForm.Top:=(MainForm.Height-WizardForm.Height) div 2;
WizardForm.Visible:=True;
end;
end;
procedure DeinitializeSetup;
begin
KillTimer(0,TimerID);
BASS_Stop;
BASS_Free;
MP3List.Free;
end;
2) Добавил в свой скрипт, скрипт со вторым прогресс грабом распаковкой arc архива? получился такой скрипт:
[Setup]
SourceDir=.
OutputDir=Setup
AppName=StarCraft
AppVerName=StarCraft
AppVersion=StarCraft
AppPublisher=Skynet
AppCopyright=Skynet
DefaultDirName={pf}\StarCraft
DefaultGroupName=StarCraft
AllowNoIcons=yes
OutputBaseFilename=starik
WindowVisible=no
WindowShowCaption=no
WindowResizable=no
Compression=lzma/fast
WizardImageFile=C:\Program Files\Smart Install Maker\Bitmaps\Import\Bmp014.bmp
WizardSmallImageFile=C:\Program Files\Smart Install Maker\Bitmaps\Import\Bmp015.bmp
[Languages]
Name: "russian"; MessagesFile: "compiler:Languages\Russian.isl"
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"
[Files]
Source: "isxbb.dll"; DestDir: {tmp}; Flags: ignoreversion dontcopy nocompression
Source: "C:\Users\Skynet\Desktop\starcraft.jpg"; DestDir: {tmp}; Flags: ignoreversion dontcopy nocompression
Source: "C:\Users\Skynet\Desktop\img_2862_starcraft-0002.jpg"; DestDir: {tmp}; Flags: ignoreversion dontcopy nocompression
Source: "C:\Users\Skynet\Desktop\1221340359_starcraft.front_cover.jpg"; 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: "D:\Music\blur_-_song2.mp3"; DestDir: {tmp}; Flags: ignoreversion dontcopy nocompression
Source: "E:\StarCraft\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs sortfilesbyextension
Source: E:\starcraft\arc.exe; DestDir: {app};
Source: E:\starcraft\starcraft.arc; DestDir: {app};
Source: {app}\starcraft.arc; DestDir: {app}; Afterinstall: UnpackArc('starcraft.arc'); Flags: external ignoreversion skipifsourcedoesntexist
[Icons]
Name: "{group}\StarCraft"; Filename: "{app}\StarCraft.exe"; WorkingDir: "{app}";
Name: "{userdesktop}\StarCraft"; Filename: "{app}\StarCraft.exe"; WorkingDir: "{app}"; Tasks: desktopicon;
Name: "{group}\{cm:UninstallProgram,StarCraft}"; Filename: "{uninstallexe}"
[Run]
Filename: {app}\StarCraft.exe; WorkingDir: {app}; Flags: nowait postinstall skipifsilent unchecked
[UninstallDelete]
Type: filesandordirs; Name: "{app}"
[_ISTool]
EnableISX=True
[Code]
type
HSTREAM=DWORD;
TTimerProc=procedure(uTimerID,uMessage:UINT;dwUser,dw1,dw2:DWORD);
const
BackGround=6;
Timer=16;
Indent=25;
var
MP3List:TStringList;
CurrentMP3:integer;
hMP3:HWND;
TimerID:LongWord;
function isxbb_AddImage(Image: PChar; Flags: Cardinal): integer; external 'isxbb_AddImage@files:isxbb.dll stdcall delayload';
function isxbb_Init(hWnd: Integer): integer; external 'isxbb_Init@files:isxbb.dll stdcall delayload';
function isxbb_StartTimer(Seconds: Integer; Flags: Cardinal): integer; external 'isxbb_StartTimer@files:isxbb.dll stdcall';
function isxbb_KillTimer(Flags: Cardinal): integer; external 'isxbb_KillTimer@files:isxbb.dll stdcall';
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('blur_-_song2.mp3');
MP3List:=TStringList.Create;
MP3List.Add(ExpandConstant('{tmp}')+'\blur_-_song2.mp3');
CurrentMP3:=0;
Result:=True;
end;
procedure InitializeWizard;
begin
WizardForm.Position:=poScreenCenter;
MainForm.BorderStyle:=bsNone;
MainForm.Width:=GetSystemMetrics(0);
MainForm.Height:=GetSystemMetrics(1)+1;
MainForm.Top:=-1;
MainForm.Left:=0;
ExtractTemporaryFile('1221340359_starcraft.front_cover.jpg');
ShowSplashScreen(WizardForm.Handle,ExpandConstant('{tmp}')+'\1221340359_starcraft.front_cover.jpg',1 000,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);
ExtractTemporaryFile('starcraft.jpg');
isxbb_AddImage(ExpandConstant('{tmp}')+'\starcraft.jpg',BackGround);
isxbb_Init(StrToInt(ExpandConstant('{hwnd}')));
MainForm.Visible:=True;
end;
procedure CurStepChanged(CurStep: TSetupStep);
begin
if CurStep=ssInstall then begin
ExtractTemporaryFile('img_2862_starcraft-0002.jpg');
isxbb_AddImage(ExpandConstant('{tmp}')+'\img_2862_starcraft-0002.jpg',BackGround or Timer);
isxbb_Init(StrToInt(ExpandConstant('{hwnd}')));
isxbb_StartTimer(4,BackGround)
end;
if CurStep=ssPostInstall then begin
isxbb_KillTimer(BackGround);
end;
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(MainForm.Width-WizardForm.Width-Indent);
WizardForm.Top:=ScaleY(MainForm.Height-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 then begin
WizardForm.Visible:=False;
WizardForm.Width:=502;
WizardForm.Height:=392;
WizardForm.Left:=(MainForm.Width-WizardForm.Width) div 2;
WizardForm.Top:=(MainForm.Height-WizardForm.Height) div 2;
WizardForm.Visible:=True;
end;
end;
procedure DeinitializeSetup;
begin
KillTimer(0,TimerID);
BASS_Stop;
BASS_Free;
MP3List.Free;
end;
[Code]
var
ProgressLabel: TLabel;
ProgressBar: TNewProgressBar;
procedure ParserLog;
var
in_File, out_File, S, S1, S2: string;
i, j, n: Integer;
begin
in_File := ExpandConstant('{app}\in_log');
out_File := ExpandConstant('{app}\out_log');
ProgressBar.Show;
ProgressLabel.Show;
// åñëè ôàéëà íåò, òî ïîäîæä¸ì... ;)
if FileExists(in_File) = False then
repeat
Application.ProcessMessages; // íåîáõîäèìà ðàñøèðåííàÿ âåðñèÿ îò Restools
n:= n + 1;
Sleep(500); // æä¸ì ïîëñåêóíäû è ïîâòîðÿåì öèêë
until (FileExists(in_File) = True) or (n = 10); // ìàêñèìàëüíî ïîâòîðÿåì öèêë 10 ðàç, ÷òî ñîñòàâèò 5 ñåêóíä...
// åñëè âñ¸ æå ôàéëà íåò, òî âûõîäèì
if FileExists(in_File) = False then Exit;
// åñëè ôàéë ñóùåñòâóåò, òî îáðîáàòûâàåì åãî
repeat
FileCopy(in_File, out_File, False); // êîïèðóì ôàéë, ÷òîá ìîæíî áûëî îòêðûòü out_File äëÿ ÷òåíèÿ
LoadStringFromFile(out_File, S); // åñëè ïîïûòàòüñÿ çàãðóçèòü in_File, òî íè÷åãî íå âûéäåò, ïîêà â íåãî ïèøåò Arc.exe...
Application.ProcessMessages; // íåîáõîäèìà ðàñøèðåííàÿ âåðñèÿ îò Restools
if Pos('%', S) > 0 then begin
S1:= Copy(S, Length(S) - 4, (Length(S) - 2) - (Length(S) - 4));
S2:= Copy(S, Length(S) - 4, Length(S) - (Length(S) - 5));
StringChange(S1, ' ', ''); // óäàëÿåì ïðîáåëû
for i:= 0 to 100 do if S1 = IntToStr(i) then begin
j:= StrToInt(S1);
ProgressBar.Position := j;
StringChange(S2, ' ', '');
ProgressLabel.Caption:= S2;
Application.ProcessMessages; // íåîáõîäèìà ðàñøèðåííàÿ âåðñèÿ îò Restools
end;
end;
until (Pos('Extracted', S) or Pos('ERROR', S)) > 0;
end;
procedure BatRunArc(s: string);
var
bat, str: string;
res: Integer;
begin
bat := ExpandConstant('{app}\RunArc.bat');
str := str + '@echo off' + #10#13 +
str + 'Arc x ' + s + ' -y -s2 -dp >in_log' + #10#13 +
str + 'del ' + '"' + bat + '"';
SaveStringToFile(bat, str, False);
Exec(bat, '', '', SW_HIDE, ewNoWait, res);
end;
procedure UnpackArc(s: string);
begin
WizardForm.CancelButton.Enabled:= False; // îòêëþ÷àåì êíîïêó 'Îòìåíà'
BatRunArc(s); // ñîçäà¸ì áàòíèê äëÿ çàïóñêà Arc.exe
WizardForm.StatusLabel.Caption:= 'Ðàñïàêîâêà àðõèâà, æäèòå...';
ParserLog; // îáðàáàòûâàåì ëîã ôàéë
WizardForm.StatusLabel.Caption:= WizardForm.StatusLabel.Caption;
ProgressBar.Position := 100;
// óäàëÿåì ëèøíåå
DelayDeleteFile(ExpandConstant('{app}\out_log'), 2);
DelayDeleteFile(ExpandConstant('{app}\in_log'), 2);
DelayDeleteFile(ExpandConstant('{app}\Arc.exe'), 2);
DelayDeleteFile(ExpandConstant('{app}\') + s, 2);
end;
procedure InitializeWizard;
begin
// âòîðîé ïðîãðåññáàð
ProgressBar := TNewProgressBar.Create(WizardForm);
with ProgressBar do begin
Left := WizardForm.ProgressGauge.Left;
Top := WizardForm.ProgressGauge.Top + ScaleX(30);
Width := WizardForm.ProgressGauge.Width;
Height := WizardForm.ProgressGauge.Height;
Parent := WizardForm.InstallingPage;
Position := 0;
Hide;
end;
// ñîçäà¸ì Label äëÿ îòîáðàæåíèÿ ïðîöåíòîâ
ProgressLabel := TLabel.Create(WizardForm);
with ProgressLabel do begin
Left := ProgressBar.Left;
Top := ProgressBar.Top + ProgressBar.Height + ScaleX(5);
AutoSize:= True;
Caption:= '0%';
Parent := WizardForm.InstallingPage;
Transparent:= True;
Hide;
end;
end;
И компиляция ругается на это:
http://s56.radikal.ru/i153/0905/f7/a35e8bb58f64.jpg
Насколько я понимаю, что два раза запущено одно и тоже......как совместить код?
BlackSelf
31-05-2009, 13:05
SkynetAst, вот совмещенный код, пробуйте:
[Setup]
SourceDir=.
OutputDir=Setup
AppName=StarCraft
AppVerName=StarCraft
AppVersion=StarCraft
AppPublisher=Skynet
AppCopyright=Skynet
DefaultDirName={pf}\StarCraft
DefaultGroupName=StarCraft
AllowNoIcons=yes
OutputBaseFilename=starik
WindowVisible=no
WindowShowCaption=no
WindowResizable=no
Compression=lzma/fast
WizardImageFile=C:\Program Files\Smart Install Maker\Bitmaps\Import\Bmp014.bmp
WizardSmallImageFile=C:\Program Files\Smart Install Maker\Bitmaps\Import\Bmp015.bmp
[Languages]
Name: "russian"; MessagesFile: "compiler:Languages\Russian.isl"
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"
[Files]
Source: "isxbb.dll"; DestDir: {tmp}; Flags: ignoreversion dontcopy nocompression
Source: "C:\Users\Skynet\Desktop\starcraft.jpg"; DestDir: {tmp}; Flags: ignoreversion dontcopy nocompression
Source: "C:\Users\Skynet\Desktop\img_2862_starcraft-0002.jpg"; DestDir: {tmp}; Flags: ignoreversion dontcopy nocompression
Source: "C:\Users\Skynet\Desktop\1221340359_starcraft.front_cover.jpg"; 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: "D:\Music\blur_-_song2.mp3"; DestDir: {tmp}; Flags: ignoreversion dontcopy nocompression
Source: "E:\StarCraft\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs sortfilesbyextension
Source: E:\starcraft\arc.exe; DestDir: {app};
Source: E:\starcraft\starcraft.arc; DestDir: {app};
Source: {app}\starcraft.arc; DestDir: {app}; Afterinstall: UnpackArc('starcraft.arc'); Flags: external ignoreversion skipifsourcedoesntexist
[Icons]
Name: "{group}\StarCraft"; Filename: "{app}\StarCraft.exe"; WorkingDir: "{app}";
Name: "{userdesktop}\StarCraft"; Filename: "{app}\StarCraft.exe"; WorkingDir: "{app}"; Tasks: desktopicon;
Name: "{group}\{cm:UninstallProgram,StarCraft}"; Filename: "{uninstallexe}"
[Run]
Filename: {app}\StarCraft.exe; WorkingDir: {app}; Flags: nowait postinstall skipifsilent unchecked
[UninstallDelete]
Type: filesandordirs; Name: "{app}"
[_ISTool]
EnableISX=True
[_code]
type
HSTREAM=DWORD;
TTimerProc=procedure(uTimerID,uMessage:UINT;dwUser,dw1,dw2:DWORD);
const
BackGround=6;
Timer=16;
Indent=25;
var
MP3List:TStringList;
CurrentMP3:integer;
hMP3:HWND;
TimerID:LongWord;
ProgressLabel: TLabel;
ProgressBar: TNewProgressBar;
function isxbb_AddImage(Image: PChar; Flags: Cardinal): integer; external 'isxbb_AddImage@files:isxbb.dll stdcall delayload';
function isxbb_Init(hWnd: Integer): integer; external 'isxbb_Init@files:isxbb.dll stdcall delayload';
function isxbb_StartTimer(Seconds: Integer; Flags: Cardinal): integer; external 'isxbb_StartTimer@files:isxbb.dll stdcall';
function isxbb_KillTimer(Flags: Cardinal): integer; external 'isxbb_KillTimer@files:isxbb.dll stdcall';
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('blur_-_song2.mp3');
MP3List:=TStringList.Create;
MP3List.Add(ExpandConstant('{tmp}')+'\blur_-_song2.mp3');
CurrentMP3:=0;
Result:=True;
end;
procedure ParserLog;
var
in_File, out_File, S, S1, S2: string;
i, j, n: Integer;
begin
in_File := ExpandConstant('{app}\in_log');
out_File := ExpandConstant('{app}\out_log');
ProgressBar.Show;
ProgressLabel.Show;
// åñëè ôàéëà íåò, òî ïîäîæä¸ì...
if FileExists(in_File) = False then
repeat
Application.ProcessMessages; // íåîáõîäèìà ðàñøèðåííàÿ âåðñèÿ îò Restools
n:= n + 1;
Sleep(500); // æä¸ì ïîëñåêóíäû è ïîâòîðÿåì öèêë
until (FileExists(in_File) = True) or (n = 10); // ìàêñèìàëüíî ïîâòîðÿåì öèêë 10 ðàç, ÷òî ñîñòàâèò 5 ñåêóíä...
// åñëè âñ¸ æå ôàéëà íåò, òî âûõîäèì
if FileExists(in_File) = False then Exit;
// åñëè ôàéë ñóùåñòâóåò, òî îáðîáàòûâàåì åãî
repeat
FileCopy(in_File, out_File, False); // êîïèðóì ôàéë, ÷òîá ìîæíî áûëî îòêðûòü out_File äëÿ ÷òåíèÿ
LoadStringFromFile(out_File, S); // åñëè ïîïûòàòüñÿ çàãðóçèòü in_File, òî íè÷åãî íå âûéäåò, ïîêà â íåãî ïèøåò Arc.exe...
Application.ProcessMessages; // íåîáõîäèìà ðàñøèðåííàÿ âåðñèÿ îò Restools
if Pos('%', S) > 0 then begin
S1:= Copy(S, Length(S) - 4, (Length(S) - 2) - (Length(S) - 4));
S2:= Copy(S, Length(S) - 4, Length(S) - (Length(S) - 5));
StringChange(S1, ' ', ''); // óäàëÿåì ïðîáåëû
for i:= 0 to 100 do if S1 = IntToStr(i) then begin
j:= StrToInt(S1);
ProgressBar.Position := j;
StringChange(S2, ' ', '');
ProgressLabel.Caption:= S2;
Application.ProcessMessages; // íåîáõîäèìà ðàñøèðåííàÿ âåðñèÿ îò Restools
end;
end;
until (Pos('Extracted', S) or Pos('ERROR', S)) > 0;
end;
procedure BatRunArc(s: string);
var
bat, str: string;
res: Integer;
begin
bat := ExpandConstant('{app}\RunArc.bat');
str := str + '@echo off' + #10#13 +
str + 'Arc x ' + s + ' -y -s2 -dp >in_log' + #10#13 +
str + 'del ' + '"' + bat + '"';
SaveStringToFile(bat, str, False);
Exec(bat, '', '', SW_HIDE, ewNoWait, res);
end;
procedure UnpackArc(s: string);
begin
WizardForm.CancelButton.Enabled:= False; // îòêëþ÷àåì êíîïêó 'Îòìåíà'
BatRunArc(s); // ñîçäà¸ì áàòíèê äëÿ çàïóñêà Arc.exe
WizardForm.StatusLabel.Caption:= 'Ðàñïàêîâêà àðõèâà, æäèòå...';
ParserLog; // îáðàáàòûâàåì ëîã ôàéë
WizardForm.StatusLabel.Caption:= WizardForm.StatusLabel.Caption;
ProgressBar.Position := 100;
// óäàëÿåì ëèøíåå
DelayDeleteFile(ExpandConstant('{app}\out_log'), 2);
DelayDeleteFile(ExpandConstant('{app}\in_log'), 2);
DelayDeleteFile(ExpandConstant('{app}\Arc.exe'), 2);
DelayDeleteFile(ExpandConstant('{app}\') + s, 2);
end;
procedure InitializeWizard;
begin
WizardForm.Position:=poScreenCenter;
MainForm.BorderStyle:=bsNone;
MainForm.Width:=GetSystemMetrics(0);
MainForm.Height:=GetSystemMetrics(1)+1;
MainForm.Top:=-1;
MainForm.Left:=0;
ExtractTemporaryFile('1221340359_starcraft.front_cover.jpg');
ShowSplashScreen(WizardForm.Handle,ExpandConstant('{tmp}')+'\1221340359_starcraft.front_cover.jpg',1 000,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);
ExtractTemporaryFile('starcraft.jpg');
isxbb_AddImage(ExpandConstant('{tmp}')+'\starcraft.jpg',BackGround);
isxbb_Init(StrToInt(ExpandConstant('{hwnd}')));
MainForm.Visible:=True;
// âòîðîé ïðîãðåññáàð
ProgressBar := TNewProgressBar.Create(WizardForm);
with ProgressBar do begin
Left := WizardForm.ProgressGauge.Left;
Top := WizardForm.ProgressGauge.Top + ScaleX(30);
Width := WizardForm.ProgressGauge.Width;
Height := WizardForm.ProgressGauge.Height;
Parent := WizardForm.InstallingPage;
Position := 0;
Hide;
end;
// ñîçäà¸ì Label äëÿ îòîáðàæåíèÿ ïðîöåíòîâ
ProgressLabel := TLabel.Create(WizardForm);
with ProgressLabel do begin
Left := ProgressBar.Left;
Top := ProgressBar.Top + ProgressBar.Height + ScaleX(5);
AutoSize:= True;
Caption:= '0%';
Parent := WizardForm.InstallingPage;
Transparent:= True;
Hide;
end;
end;
procedure CurStepChanged(CurStep: TSetupStep);
begin
if CurStep=ssInstall then begin
ExtractTemporaryFile('img_2862_starcraft-0002.jpg');
isxbb_AddImage(ExpandConstant('{tmp}')+'\img_2862_starcraft-0002.jpg',BackGround or Timer);
isxbb_Init(StrToInt(ExpandConstant('{hwnd}')));
isxbb_StartTimer(4,BackGround)
end;
if CurStep=ssPostInstall then begin
isxbb_KillTimer(BackGround);
end;
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(MainForm.Width-WizardForm.Width-Indent);
WizardForm.Top:=ScaleY(MainForm.Height-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 then begin
WizardForm.Visible:=False;
WizardForm.Width:=502;
WizardForm.Height:=392;
WizardForm.Left:=(MainForm.Width-WizardForm.Width) div 2;
WizardForm.Top:=(MainForm.Height-WizardForm.Height) div 2;
WizardForm.Visible:=True;
end;
end;
procedure DeinitializeSetup;
begin
KillTimer(0,TimerID);
BASS_Stop;
BASS_Free;
MP3List.Free;
end;
Raf-9600
31-05-2009, 13:50
код с отображением путей и активной кнопкой "отмена". »
А можно без кнопки "Отмена" (ну чтоб она нигде не отображалась), но с рабочей кнопкой закрытия? Ну я имею ввиду ту копку которая правее кнопок свернуть, и развернуть, в правом верхнем углу окна.
http://uaimages.com/images/979353corel002.png
А насчет *.jpg это надо через isxbb.dll делать. »
Можете сделать? http://uaimages.com/images/918363smile_cry.gif
BlackSelf
31-05-2009, 14:06
Raf-9600
Насчет кнопки "Отмена" могу предложить следующее (бредовая идея, конечно, но всё же):
Заменить в данной строке цифру 2 на, скажем, 100. Тогда кнопка будет за пределами окна инсталлятора. Видно её не будет, но "закрыть" в правом верхнем углу будет работать.
WizardForm.CancelButton.Top := WizardForm.Bevel.Top + ScaleY(2)
А насчет *.jpg подумаю на неделе, когда время будет.
Raf-9600
31-05-2009, 15:45
Насчет кнопки "Отмена" могу предложить следующее (бредовая идея, конечно, но всё же) »
Главное что нужный эффект достигнут :)
А насчет *.jpg подумаю на неделе, когда время будет. »
Буду ждать.
SkynetAst
31-05-2009, 19:39
BlackSelf,
Попробовал....теперь вот так ругается =)) какие то кавычки не нравятся ему
http://s54.radikal.ru/i143/0905/ae/0db11a3c711d.jpg
BlackSelf
31-05-2009, 20:45
SkynetAst,
ShowSplashScreen(WizardForm.Handle,ExpandConstant('{tmp}')+'\1221340359_starcraft.front_cover.jpg',1 000,3000,1000,0,255,False,$FFFFFF,10);
SkynetAst
01-06-2009, 09:56
А как указать какое место будет занимать установка? А то показывает размер архива а не то что будет после него )
Raf-9600
01-06-2009, 10:32
SkynetAst, в справке все написано. Юзай либо "ExtraDiskSpaceRequired" в секции компонентов, либо "ExtraDiskSpaceRequired" в секции [Setup].
© OSzone.net 2001-2012
vBulletin v3.6.4, Copyright ©2000-2025, Jelsoft Enterprises Ltd.