Is it possible to have an image button in Inno Wizard page instead of a plain Caption Text?
What I would like to accomplish is to create an Off/On image button to mute/play a music while Inno setup is running.
Thanks!
There's no direct support for setting images for buttons in Inno Setup.
So you have to revert to Win32 API.
function LoadImage(hInst: Integer; ImageName: string; ImageType: UINT; X, Y: Integer;
Flags: UINT): THandle;
external '[email protected] stdcall';
function ImageList_Add(ImageList: THandle; Image, Mask: THandle): Integer;
external '[email protected] stdcall';
function ImageList_Create(CX, CY: Integer; Flags: UINT; Initial, Grow: Integer): THandle;
external '[email protected] stdcall';
const
IMAGE_BITMAP = 0;
LR_LOADFROMFILE = $10;
ILC_COLOR32 = $20;
BCM_SETIMAGELIST = $1600 + $0002;
type
BUTTON_IMAGELIST = record
himl: THandle;
margin: TRect;
uAlign: UINT;
end;
function SendSetImageListMessage(
Wnd: THandle; Msg: Cardinal; WParam: Cardinal; var LParam: BUTTON_IMAGELIST): Cardinal;
external '[email protected] stdcall';
function InitializeSetup(): Boolean;
var
ImageList: THandle;
Image: THandle;
ButtonImageList: BUTTON_IMAGELIST;
begin
ImageList := ImageList_Create(16, 16, ILC_COLOR32, 1, 1);
Image := LoadImage(0, 'button.bmp', IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
ImageList_Add(ImageList, Image, 0);
ButtonImageList.himl := ImageList;
SendSetImageListMessage(
WizardForm.NextButton.Handle, BCM_SETIMAGELIST, 0, ButtonImageList);
end;
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments