How to create an image button in Inno Setup?

Drakul

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!

Martin Prikryl

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;

enter image description here

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to create a scrollable radio button list in Inno Setup?

From Dev

How to create two LicenseFile pages in Inno Setup

From Dev

Inno Setup - How to create checkboxes at finished page?

From Dev

Create a hardlink with Inno Setup

From Dev

How to disable Next button if no component is selected in Inno Setup?

From Dev

Inno Setup - How to skip files depending on radio button

From Dev

How to disable OK button in "Browse For Folder" dialog in Inno Setup

From Dev

Inno Setup - How to skip files depending on radio button

From Dev

Inno setup compiler How to set launching image during app loading

From Dev

How to create a hotkey for desktop icon using Inno Setup

From Dev

Inno Setup: how to create a page with radio buttons and forms

From Dev

Inno Setup - How to create a new uninstalling page in a custom uninstall page?

From Dev

Inno Setup: Create simplified ComponentsList

From Dev

How to create an image-button

From Dev

Get radio button value [INNO SETUP]

From Dev

Prevent button from receiving focus in Inno Setup

From Dev

How to override functions in Inno Setup?

From Dev

How to split a string in Inno Setup

From Dev

how to refresh a page in inno setup

From Dev

How to extract a Inno Setup Installer

From Dev

Inno setup - how to change version in the setup hover?

From Dev

Inno Setup create TStringList from CDATA

From Dev

Inno Setup Code section create hidden file

From Dev

Inno setup: create a log of selected items

From Dev

Create ZIP files from within Inno Setup

From Dev

Create a small web installer using Inno Setup

From Dev

Inno setup: create a log of selected items

From Dev

Create a transparent installer using Inno Setup?

From Dev

Inno Setup - Create custom message box (yes / no)

Related Related

  1. 1

    How to create a scrollable radio button list in Inno Setup?

  2. 2

    How to create two LicenseFile pages in Inno Setup

  3. 3

    Inno Setup - How to create checkboxes at finished page?

  4. 4

    Create a hardlink with Inno Setup

  5. 5

    How to disable Next button if no component is selected in Inno Setup?

  6. 6

    Inno Setup - How to skip files depending on radio button

  7. 7

    How to disable OK button in "Browse For Folder" dialog in Inno Setup

  8. 8

    Inno Setup - How to skip files depending on radio button

  9. 9

    Inno setup compiler How to set launching image during app loading

  10. 10

    How to create a hotkey for desktop icon using Inno Setup

  11. 11

    Inno Setup: how to create a page with radio buttons and forms

  12. 12

    Inno Setup - How to create a new uninstalling page in a custom uninstall page?

  13. 13

    Inno Setup: Create simplified ComponentsList

  14. 14

    How to create an image-button

  15. 15

    Get radio button value [INNO SETUP]

  16. 16

    Prevent button from receiving focus in Inno Setup

  17. 17

    How to override functions in Inno Setup?

  18. 18

    How to split a string in Inno Setup

  19. 19

    how to refresh a page in inno setup

  20. 20

    How to extract a Inno Setup Installer

  21. 21

    Inno setup - how to change version in the setup hover?

  22. 22

    Inno Setup create TStringList from CDATA

  23. 23

    Inno Setup Code section create hidden file

  24. 24

    Inno setup: create a log of selected items

  25. 25

    Create ZIP files from within Inno Setup

  26. 26

    Create a small web installer using Inno Setup

  27. 27

    Inno setup: create a log of selected items

  28. 28

    Create a transparent installer using Inno Setup?

  29. 29

    Inno Setup - Create custom message box (yes / no)

HotTag

Archive