[Setup]
AppName=test
AppVerName=test
CreateAppDir=false
DefaultDirName={tmp}
Uninstallable=false
WizardImageFile=1.bmp
[Languages]
Name: ru; MessagesFile: compiler:Languages\russian.isl
[code]
#define A = (Defined UNICODE) ? "W" : "A"
const
CN_CTLCOLORBTN = $BD35;
GA_ROOT = 2;
GWL_WNDPROC = (-4);
GWL_USERDATA = (-21);
function GetWindowLong(hWnd: HWND; nIndex: Integer): Longint; external 'GetWindowLong{#A}@user32.dll stdcall';
function SetWindowLong(hWnd: HWND; nIndex: Integer; dwNewLong: Longint): Longint; external 'SetWindowLong{#A}@user32.dll stdcall';
function CreatePatternBrush(hbmp: HBITMAP): Longint; external 'CreatePatternBrush@gdi32.dll stdcall';
function CallWindowProc(lpPrevWndFunc: Longint; hWnd: HWND; Msg: UINT; wParam: Longint; lParam: Longint): Longint; external 'CallWindowProc{#A}@user32.dll stdcall';
function MapWindowPoints(hWndFrom, hWndTo: HWND; var lpPoints: TPoint; cPoints: UINT): Integer; external 'MapWindowPoints@user32.dll stdcall';
function SetBrushOrgEx(hdc: Longint; nXOrg, nYOrg: Integer; var lppt: TPoint): BOOL; external 'SetBrushOrgEx@gdi32.dll stdcall';
function GetAncestor(hwnd: HWND; gaFlags: UINT): HWND; external 'GetAncestor@user32.dll stdcall';
var
g_hBrush: Longint;
/////////////////////////////////////////////////////////////////////////////
function ButtonProc(hWnd: HWND; Msg: UINT; wParam, lParam: Longint): Longint;
var
pt: TPoint;
begin
case Msg of
CN_CTLCOLORBTN: begin
MapWindowPoints(hWnd, GetAncestor(hWnd, GA_ROOT), pt, 1);
SetBrushOrgEx(wParam, -pt.x, -pt.y, pt);
Result := g_hBrush;
end;
else
Result := CallWindowProc(GetWindowLong(hWnd, GWL_USERDATA), hWnd, Msg, wParam, lParam);
end;
end;
/////////////////////////////
procedure InitializeWizard();
begin
with WizardForm do
begin
WizardBitmapImage.Width:= WizardForm.ClientWidth;
WizardBitmapImage.Height:= WizardForm.ClientHeight;
Bevel.Hide;
OuterNotebook.Hide;
WizardBitmapImage.Parent:= WizardForm;
g_hBrush := CreatePatternBrush(WizardBitmapImage.Bitmap.Handle);
end;
with WizardForm.NextButton do SetWindowLong(Handle, GWL_USERDATA, SetWindowLong(Handle, GWL_WNDPROC, CallbackAddr('ButtonProc')));
with WizardForm.BackButton do SetWindowLong(Handle, GWL_USERDATA, SetWindowLong(Handle, GWL_WNDPROC, CallbackAddr('ButtonProc')));
with WizardForm.CancelButton do SetWindowLong(Handle, GWL_USERDATA, SetWindowLong(Handle, GWL_WNDPROC, CallbackAddr('ButtonProc')));
end;
procedure DeinitializeSetup();
begin
with WizardForm.NextButton do if GetWindowLong(Handle, GWL_USERDATA) > 0 then SetWindowLong(Handle, GWL_WNDPROC, GetWindowLong(Handle, GWL_USERDATA));
with WizardForm.BackButton do if GetWindowLong(Handle, GWL_USERDATA) > 0 then SetWindowLong(Handle, GWL_WNDPROC, GetWindowLong(Handle, GWL_USERDATA));
with WizardForm.CancelButton do if GetWindowLong(Handle, GWL_USERDATA) > 0 then SetWindowLong(Handle, GWL_WNDPROC, GetWindowLong(Handle, GWL_USERDATA));
end;