如何在nsis中动态更改自定义页面标签文本?

时间:2014-02-07 11:33:51

标签: installer nsis

我已经编写了一个自定义页面,我想动态更改标签文本。我尝试了下面的代码,但有些我不能打包来更改文本。

    Function Maintainance 
    nsDialogs::Create 1018
        Pop $Dialog
        ${If} $Dialog == error
            Abort
        ${EndIf}


        ${NSD_CreateLabel} 0 0 100% 12u "The $CurrentVersion complete installation folder is available at the below link"
        Pop $Label
    FindWindow $0 "#32770" "" $HWNDPARENT
     GetDlgItem $1 $0 1006


    SendMessage $1 ${WM_SETTEXT} 0 "STR:new value 111111"
    nsDialogs::Show
FunctionEnd

这方面的任何指针都是一个帮助。

1 个答案:

答案 0 :(得分:0)

在调用nsDialogs :: Show之前,自定义页面不可见。之后,任何动态操作都必须使用计时器或响应用户操作:

Page Custom MyPageCreate
Page InstFiles

!include nsDialogs.nsh

var mylabel

Function MyPageCreate
nsDialogs::Create 1018
Pop $0
${NSD_CreateLabel} 0 0 100% 12u "Hello"
Pop $mylabel
${NSD_CreateButton} 0 50% 50% 12u "Change"
Pop $0
${NSD_OnClick} $0 ChangeIt
nsDialogs::Show
FunctionEnd

Function ChangeIt
System::Call kernel32::GetTickCount()i.r0
SendMessage $mylabel ${WM_SETTEXT} 0 "STR:World! $0"
FunctionEnd