开发者

Adding custom labels in NSIS dialog pages, showing and hiding labels in NSIS MUI Directory pages conditionally, how to get the ids of labels

开发者 https://www.devze.com 2023-03-01 08:04 出处:网络
How to hide a Custom LABEL added on the Directory Page Dialog of the NSIS installer. The LABEL is added using the Resource Hacker and its id is 1300

How to hide a Custom LABEL added on the Directory Page Dialog of the NSIS installer. The LABEL is added using the Resource Hacker and its id is 1300

How to change the text of the LABEL conditionally?

If user choses to install DEMO, then the label text should be "DEMO" , and if user choses to install UPDATE , then the label text should be "UPDATE"

I have added 2 labels, now i am hiding and showing them accordingly.Label1 ID is 1300 , Label2 ID is 1301.

# Occurs on Directory page show.
Function DirectoryShow

   ${If} $InstallType == DEMO

    GetDlgItem $5 $HWNDPARENT 1300
MessageBox MB_OK "ID of First Label is $5"  ----IT SHOWS '0' INSTEAD OF SHOWING 1300

 ${NSD_SetText} $5 "INSTALLING DEMO OF SOFTWARE!!!!!!!!!!!!!!!!!" 

GetDlgItem $6 $HWNDPARENT 1301
ShowWindow $6 ${SW_HIDE}

;GetDlgItem $1 $HWNDPARENT 2
;ShowWindow $0 ${SW_SHOW}
;ShowWindow $1 ${SW_HIDE}

 ${Else}

GetDlgItem $7 $HWNDPARENT 1300
ShowWindow $7 ${SW_HIDE}

GetDlgItem $8 $HWNDPARENT 1301
 ${NSD_SetText} $8 "UPDATING EXISTING SOFTWARE !!!!!!!!!!!!!!!!!" 

${EndIf}
FunctionEnd 

HOW DO I GET THE ID开发者_运维技巧 OF THESE LABELS?


NSIS uses a child dialog to host the actual pages:

Adding custom labels in NSIS dialog pages, showing and hiding labels in NSIS MUI Directory pages conditionally, how to get the ids of labels

You first need to get the handle to the inner dialog, then you can find the label:

FindWindow $0 "#32770" "" $HWNDPARENT ;(This is documented under section 4.9.14.6 in the help file)
GetDlgItem $5 $0 1300
0

精彩评论

暂无评论...
验证码 换一张
取 消