2012-04-12 4 views
6

ProgressGauge 막대 아래의 이미지를 표시하는 간단한 스크립트를 wpInstalling 페이지에 준비했습니다.Inno Setup - ProgressGauge bar 아래의 wp 설치 페이지에 여러 이미지 표시 (슬라이드 쇼)

하지만 더 복잡한 기능이 필요합니다.

설치가 X (예 : 7 초) (설치 시간이 길면 X 초 * 이미지 수가 늘어남) 또는 설치 후 X (예 : 10) 후에 각각 여러 이미지가 표시됩니다. ProgressGauge.Position에 이미지를 표시하려고했지만 실패했습니다. 여기

내가 무엇을 가지고 :

procedure CurPageChanged(CurPageID: Integer); 
var 
    BmpFile: TBitmapImage; 
begin 
    ExtractTemporaryFile('01.bmp'); 
    ExtractTemporaryFile('02.bmp'); 
    ExtractTemporaryFile('03.bmp'); 

    if CurPageID = wpInstalling then 
    begin 
    BmpFile:= TBitmapImage.Create(WizardForm); 
    BmpFile.Bitmap.LoadFromFile(ExpandConstant('{tmp}\01.bmp')); 
    BmpFile.Width:= ScaleX(420); 
    BmpFile.Height:= ScaleY(180); 
    BmpFile.Left := WizardForm.ProgressGauge.Left + ScaleX(0); 
    BmpFile.Top := WizardForm.ProgressGauge.Top + ScaleY(35); 

    // BmpFile.Parent:= WizardForm.InstallingPage; 
    // BmpFile:= TBitmapImage.Create(WizardForm); 
    // BmpFile.Bitmap.LoadFromFile(ExpandConstant('{tmp}\03.bmp')); 
    // BmpFile.Width:= ScaleX(420); 
    // BmpFile.Height:= ScaleY(400); 
    // BmpFile.Left := WizardForm.ProgressGauge.Left + ScaleX(0); 
    // BmpFile.Top := WizardForm.ProgressGauge.Top + ScaleY(35); 
    // BmpFile.Parent:= WizardForm.InstallingPage; 

    // BmpFile:= TBitmapImage.Create(WizardForm); 
    // BmpFile.Bitmap.LoadFromFile(ExpandConstant('{tmp}\03.bmp')); 
    // BmpFile.Width:= ScaleX(420); 
    // BmpFile.Height:= ScaleY(400); 
    // BmpFile.Left := WizardForm.ProgressGauge.Left + ScaleX(0); 
    // BmpFile.Top := WizardForm.ProgressGauge.Top + ScaleY(35); 
    // BmpFile.Parent:= WizardForm.InstallingPage; 
    end; 
end; 

목적은 다음과 같습니다 wpInstalling
표시 X 이미지, X 초 당 또는 설치의 X 퍼센트 후마다 다음이 있어야합니다.

답변

7

ProgressGauge에는 진행 변경 이벤트가 없으므로 설치 응용 프로그램 메시지를 처리 ​​할 방법이 없으므로 Windows API 타이머를 사용해야합니다. 이 타이머는 Inno Setup 스크립트에서 정의 할 수없는 콜백 함수를 필요로하기 때문에이 작업을 수행하기 위해 외부 라이브러리가 필요합니다. 그러나 정확하게 이것을 할 수있는 InnoCallback 라이브러리가 있습니다. 다음 코드를

이 설치 디렉토리에 InnoCallback.dll 라이브러리를 복사하여 이노 설치 스크립트를 사용하여이 코드를 병합하고 현재 설정 (초마다 주기적으로 호출 될 OnSlideTimer 이벤트에서 슬라이드 쇼 페이지 터닝 어떤 종류의 구현).

[Files] 
Source: "InnoCallback.dll"; DestDir: "{tmp}"; Flags: dontcopy 

[code] 
var 
    TimerID: Integer; 

type 
    TTimerProc = procedure(Wnd: HWND; Msg: UINT; TimerID: UINT_PTR; 
    SysTime: DWORD); 

function WrapTimerProc(Callback: TTimerProc; ParamCount: Integer): LongWord; 
    external '[email protected]:InnoCallback.dll stdcall';  
function SetTimer(hWnd: HWND; nIDEvent, uElapse: UINT; 
    lpTimerFunc: UINT): UINT; external '[email protected] stdcall'; 
function KillTimer(hWnd: HWND; uIDEvent: UINT): BOOL; 
    external '[email protected] stdcall'; 

procedure OnSlideTimer(Wnd: HWND; Msg: UINT; TimerID: UINT_PTR; 
    SysTime: DWORD); 
begin 
    { here you can turn your slideshow pages; use some variable to store the } 
    { current index of the slide you are on, note that this procedure is called } 
    { periodically each 1000 ms (see below why), so here you can also check the } 
    { progress value, if you want to } 
end; 

procedure StartSlideTimer; 
var 
    TimerCallback: LongWord; 
begin 
    TimerCallback := WrapTimerProc(@OnSlideTimer, 4); 
    { third parameter here is the timer's timeout value in milliseconds } 
    TimerID := SetTimer(0, 0, 1000, TimerCallback); 
end; 

procedure KillSlideTimer; 
begin 
    if TimerID <> 0 then 
    begin 
    if KillTimer(0, TimerID) then 
     TimerID := 0; 
    end; 
end; 

function InitializeSetup: Boolean; 
begin 
    Result := True; 
    TimerID := 0; 
end; 

procedure DeinitializeSetup; 
begin 
    KillSlideTimer; 
end; 

procedure CurPageChanged(CurPageID: Integer); 
begin 
    if CurPageID = wpInstalling then 
    StartSlideTimer 
    else 
    KillSlideTimer; 
end; 
+0

내 문제가 해결되었습니다. 전역 변수 인덱스를 추가했습니다 : 정수; 및 이미지 (IntToStr) – RobeN

+1

그래, 거기에 시간 카운터가 필요하거나 진행률 계기에 액세스 할 수있는 약간 수정 된 코드. 그렇기 때문에 타이머 이벤트를 구현하는 방법 만 보여주었습니다 .-)하지만 오류가 발생해도 슬라이드 쇼를 계속 회전 시키면 화면이 너무 좋아 보이지 않기 때문에 진행 상태를 확인해야합니다. 나는 당신이'WizardForm.ProgressGauge.State = npbsNormal' 일 때만 이미지를 슬라이드해야한다고 생각하지만, 역시 당신에게 달려있다. 사용 가능한 진행 상태는 ['here'] (http://www.jrsoftware.org/ishelp/topic_scriptclasses.htm#TNewProgressBarState)를 참조하십시오. – TLama

+1

나는 그랬다. '일시 중지됨', '오류'및 '위치 = 최대'특수 기능 (타사 앱 설치 중). 도움과 지원에 감사드립니다! – RobeN

2

이미지를 변경하기 위해 각 파일 항목에 AfterInstall을 사용하지 않는 이유는 무엇입니까?

+0

그건 내가 필요로하는 것이 아닙니다. TLama의 솔루션은 (적어도 나를 위해) 더 좋습니다. – RobeN

+0

작업 예제를 보는 것이 좋을 것입니다 ...이 스크립트가 제대로 작동하도록하는 데 여전히 문제가 있습니다. – Dielo