installationnsis

NSIS - Please tell me how to use 'NSD_SetIconFromInstaller'


I want to display the icon in the window.

How can I make the setup icon appear inside the window?

Here is the code.

Name "Project 1"
OutFile "Setup.exe"
XPStyle on
Icon "C:\Project 1\Bin\Main.ico"

!include nsDialogs.nsh
!include LogicLib.nsh

Page custom Welcome
Page instfiles

Function Welcome
  nsDialogs::Create 1018
  {$NSD_CreateIcon} 0 0 32 32
  Pop $1
  {NSD_SetIconFromInstaller} $1 $0
  ${NSD_CreateLabel} 40 0 100% 30u "Welcome to the setup wizard!"

  nsDialogs::Show

FunctionEnd

Section
  File "C:\Project 1\Bin\Application.exe"
  File "C:\Project 1\Bin\Application.dll"
  ...
SectionEnd 
  

Solution

  • !include nsDialogs.nsh
    
    Page custom Welcome
    Page instfiles
    
    Function Welcome
        nsDialogs::Create 1018
        Pop $1
        ${NSD_CreateIcon} 0 0 32 32 ""
        Pop $1
        ${NSD_SetIconFromInstaller} $1 $2
        ${NSD_CreateLabel} 40 0 100% 30u "Welcome to the setup wizard!"
        Pop $1
    
        nsDialogs::Show
        ${NSD_FreeIcon} $2
    FunctionEnd