是否可以在Inno Wizard页面中使用图像按钮而不是普通的标题文本?
我想要完成的是在Inno设置运行时创建一个Off / On图像按钮来静音/播放音乐。
谢谢!
答案 0 :(得分:1)
在Inno Setup中没有直接支持设置按钮的图像。
所以你必须恢复到Win32 API。
function LoadImage(hInst: Integer; ImageName: string; ImageType: UINT; X, Y: Integer;
Flags: UINT): THandle;
external 'LoadImageW@User32.dll stdcall';
function ImageList_Add(ImageList: THandle; Image, Mask: THandle): Integer;
external 'ImageList_Add@Comctl32.dll stdcall';
function ImageList_Create(CX, CY: Integer; Flags: UINT; Initial, Grow: Integer): THandle;
external 'ImageList_Create@Comctl32.dll 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 'SendMessageW@User32.dll 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;