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

StackOverflow https://stackoverflow.com/questions/5831920

문제

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:

enter image description here

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
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top