Как в inno setup добавить всплывающее окно описания компонентов?
Что-то похожое на этот скрипт или добавить к нему.
Что-то похожое на этот скрипт или добавить к нему.
Код:
[Setup]
AppName=My Program
AppVerName=My Program v.1
DefaultDirName={pf}\My Program
Compression=none
AppId=TheBestAppId
DisableWelcomePage=yes
DisableFinishedPage=yes
DisableDirPage=yes
DisableReadyPage=yes
[Components]
Name: qwe; Description: 1; Flags: disablenouninstallwarning
Name: asd; Description: 2; Flags: disablenouninstallwarning
Name: zxc; Description: 3; Flags: disablenouninstallwarning
[Files]
Source:img\1.bmp; Flags: dontcopy nocompression
Source:img\2.bmp; Flags: dontcopy nocompression
Source:img\3.bmp; Flags: dontcopy nocompression
[code]
#ifdef UNICODE
#define A "W"
#else
#define A "A"
#endif
const
UNDEF_INDEX = -777;
ALPHA_BLEND_LEVEL = 128; // max=Byte=255
WS_EX_LAYERED = $80000;
WS_EX_TRANSPARENT = $100;
LWA_COLORKEY = 1;
LWA_ALPHA = 2;
GWL_EXSTYLE = (20);
var
InfoPic: TBitmapImage;
LastIndex: Integer;
TempPath: String;
PicForm: TForm;
type
COLORREF = DWORD;
function GetCursorPos(var lpPoint: TPoint): BOOL; external 'GetCursorPos@user32.dll stdcall';
function SetLayeredWindowAttributes(Hwnd: THandle; crKey: COLORREF; bAlpha: Byte; dwFlags: DWORD): Boolean; external 'SetLayeredWindowAttributes@user32.dll stdcall';
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 SetFocus(hWnd: HWND): HWND; external 'SetFocus@user32.dll stdcall';
procedure ShowPicHint(const PicFilePath: String);
var
pt: TPoint;
begin
if not GetCursorPos(pt) then Exit;
InfoPic.Bitmap.LoadFromFile(PicFilePath);
try
with PicForm do
begin
SetBounds(ScaleX(pt.x + 16), ScaleY(pt.y + 7), InfoPic.Width, InfoPic.Height);
SetWindowLong(Handle, GWL_EXSTYLE, GetWindowLong(Handle, GWL_EXSTYLE) or WS_EX_LAYERED);
SetLayeredWindowAttributes(Handle, 0, ALPHA_BLEND_LEVEL, LWA_ALPHA);
Show;
end;
finally
SetFocus(WizardForm.Handle);
end;
end;
procedure CompOnItemMouseMove(Sender: TObject; X, Y: Integer; Index: Integer; Area: TItemArea);
var
UndefPic: String;
begin
if Index = -1 then Exit;
if Index = LastIndex then Exit;
try
case TNewCheckListBox(Sender).ItemCaption[Index] of
'1': UndefPic := '1.bmp';
'2': UndefPic := '2.bmp';
'3': UndefPic := '3.bmp';
'': UndefPic := '.bmp';
else
begin
LastIndex := UNDEF_INDEX;
PicForm.Hide;
Exit;
end;
end;
if not FileExists(TempPath + UndefPic) then ExtractTemporaryFile(UndefPic);
ShowPicHint(TempPath + UndefPic);
finally
LastIndex := Index;
end;
end;
procedure CompOnMouseLeave(Sender: TObject);
begin
PicForm.Hide;
end;
procedure InitInfo();
begin
WizardForm.ComponentsList.OnItemMouseMove := @CompOnItemMouseMove;
WizardForm.ComponentsList.OnMouseLeave := @CompOnMouseLeave;
TempPath := AddBackslash(ExpandConstant('{tmp}'));
LastIndex := UNDEF_INDEX;
PicForm := TForm.Create(WizardForm)
with PicForm do
begin
BorderStyle := bsNone;
FormStyle := fsStayOnTop;
InfoPic := TBitmapImage.Create(PicForm)
with InfoPic do
begin
Parent := PicForm;
AutoSize := True;
end;
end;
end;
procedure InitializeWizard();
begin
InitInfo();
end;