Change caption of installer at runtime: Difference between revisions
From NSIS Wiki
Jump to navigationJump to search
(initial) |
|||
Line 8: | Line 8: | ||
SendMessage $HWNDPARENT ${WM_SETTEXT} 0 "STR:Your text" | SendMessage $HWNDPARENT ${WM_SETTEXT} 0 "STR:Your text" | ||
</highlight-nsis> | </highlight-nsis> | ||
This can be abstracted as a macro through: | |||
<highlight-nsis> | |||
!include "WinMessages.nsh" | |||
!define SetTitleBar "!insertmacro SetTitleBar" | |||
!macro SetTitlebar Str | |||
SendMessage $HWNDPARENT ${WM_SETTEXT} 0 "STR:${Str}" | |||
!macroend | |||
</highlit-nsis> | |||
Have a look at the following sample. | Have a look at the following sample. |
Revision as of 02:24, 11 May 2008
Author: bholliger (talk, contrib) |
Description
This sample describes how to change the window title of the installer at runtime. It is based on this Forum-Thread. Thx rsegal.
The main code is
SendMessage $HWNDPARENT ${WM_SETTEXT} 0 "STR:Your text"
This can be abstracted as a macro through:
!include "WinMessages.nsh" !define SetTitleBar "!insertmacro SetTitleBar" !macro SetTitlebar Str SendMessage $HWNDPARENT ${WM_SETTEXT} 0 "STR:${Str}" !macroend </highlit-nsis> Have a look at the following sample. == Sample == <highlight-nsis> Outfile 'test.exe' InstallDir '$PROGRAMFILES\Test' !include WinMessages.nsh Caption "My Installer" page components page directory page instfiles Section "Section 1" SendMessage $HWNDPARENT ${WM_SETTEXT} 0 "STR:We are waiting... [Section 1]" Sleep 5000 SendMessage $HWNDPARENT ${WM_SETTEXT} 0 "STR:Ok, that's enough." SectionEnd Section "Section 2" SendMessage $HWNDPARENT ${WM_SETTEXT} 0 "STR:We are waiting... [Section 2]" Sleep 5000 SendMessage $HWNDPARENT ${WM_SETTEXT} 0 "STR:Ok, that's enough." SectionEnd Function .onSelChange IntOp $1 $1 + 1 SendMessage $HWNDPARENT ${WM_SETTEXT} 0 "STR:Changed sections $1 times" FunctionEnd Function .onInit StrCpy $1 "0" FunctionEnd