[Setup]
AppName=test
AppVerName=test
DefaultDirName={tmp}
DirExistsWarning=no
Uninstallable=no
CreateUninstallRegKey=no
[Files]
Source: 1.swf; Flags: dontcopy
[Code]
#define A = (Defined UNICODE) ? "W" : "A"
const
WS_CHILD = $40000000;
WS_VISIBLE = $10000000;
WS_CLIPSIBLINGS = $04000000;
WS_DISABLED = $08000000;
HWND_BOTTOM = 1;
IShockwaveFlash_Prop_Width = 8;
IShockwaveFlash_Prop_Height = 9;
function CreateWindowEx(dwExStyle: DWORD; lpClassName, lpWindowName: string; dwStyle: DWORD; x, y, nWidth, nHeight: Integer; hWndParent: HWND; hMenu: HMENU; hInstance, lpParam: Longint): HWND; external 'CreateWindowEx{#A}@user32.dll stdcall';
function DestroyWindow(hWnd: HWND): BOOL; external 'DestroyWindow@user32.dll stdcall';
function AtlAxAttachControl(pControl: IDispatch; hWnd: HWND; out ppUnkContainer: Longint): HRESULT; external 'AtlAxAttachControl@atl.dll stdcall';
function SetWindowPos(hWnd, hWndInsertAfter: HWND; X, Y, cx, cy: Integer; uFlags: UINT): BOOL; external 'SetWindowPos@user32.dll stdcall';
function GetSysColor(nIndex: Integer): DWORD; external 'GetSysColor@user32.dll stdcall';
var
hWndFlash: HWND;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function CreateFlashWindow(hWndParent: HWND; x, y, cx, cy: Integer; crBackground: TColor; szFileName: string): HWND;
(*
* hWndParent : A handle to the parent or owner window of the window being created.
* x : The initial horizontal position of the window.
* y : The initial vertical position of the window.
* cx : The width, in device units, of the window. Set to -1 to get width from flash movie
* cy : The height, in device units, of the window. Set to -1 to get height from flash movie
* crBackground: The flash movie background color
* szFileName : Path to flash movie file
*)
var
objFlash: Variant;
hr: HRESULT;
lppv: Longint;
begin
if not FileExists(szFileName) then Exit;
try
objFlash := CreateOleObject('ShockwaveFlash.ShockwaveFlash');
except
RaiseLastException;
end;
Result := CreateWindowEx(0, 'Message', '', WS_VISIBLE or WS_CHILD or WS_CLIPSIBLINGS or WS_DISABLED, 0, 0, 0, 0, hWndParent, 0, HInstance, 0);
if Result = 0 then Exit;
hr := AtlAxAttachControl(IDispatch(objFlash), Result, lppv);
if hr <> 0 then Exit;
objFlash.Movie := szFileName;
while (objFlash.PercentLoaded <> 100) do
Application.ProcessMessages;
if crBackground < 0 then
objFlash.BackgroundColor := GetSysColor(crBackground and $000000FF)
else
objFlash.BackgroundColor := crBackground;
if cx = -1 then
cx := Round(objFlash.TGetPropertyAsNumber('/', IShockwaveFlash_Prop_Width));
if cy = -1 then
cy := Round(objFlash.TGetPropertyAsNumber('/', IShockwaveFlash_Prop_Height));
SetWindowPos(Result, HWND_BOTTOM, x, y, cx, cy, 0);
end;
/////////////////////////////////////////
procedure DestroyFlashWindow(hWnd: HWND);
begin
if hWnd <> 0 then
DestroyWindow(hWnd);
end;
//////////////////////////
procedure InitializeWizard;
begin
WizardForm.OuterNotebook.Hide;
ExtractTemporaryFile('1.swf');
hWndFlash := CreateFlashWindow(WizardForm.Handle, 0, 0, -1, -1, WizardForm.Color, ExpandConstant('{tmp}\1.swf'));
end;
////////////////////////////
procedure DeinitializeSetup;
begin
DestroyFlashWindow(hWndFlash);
end;