在NSIS对话框页面中添加自定义标签,有条件地在NSIS MUI目录页面中显示和隐藏标签,以及如何获取标签ID [英] Adding custom labels in NSIS dialog pages, showing and hiding labels in NSIS MUI Directory pages conditionally, how to get the ids of labels

查看:346
本文介绍了在NSIS对话框页面中添加自定义标签,有条件地在NSIS MUI目录页面中显示和隐藏标签,以及如何获取标签ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何隐藏在NSIS安装程序的目录页面"对话框中添加的自定义标签. 标签是使用Resource Hacker添加的,其ID为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

如何有条件地更改LABEL的文本?

How to change the text of the LABEL conditionally?

如果用户选择安装DEMO,则标签文本应为"DEMO",如果用户选择安装UPDATE,则标签文本应为"UPDATE"

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"

我添加了2个标签,现在我要隐藏并相应地显示它们.Label1 ID为1300,Label2 ID为1301.

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 

我如何获得这些标签的ID?

HOW DO I GET THE ID OF THESE LABELS?

推荐答案

NSIS使用子对话框来托管实际页面:

NSIS uses a child dialog to host the actual pages:

您首先需要获取内部对话框的句柄,然后才能找到标签:

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

这篇关于在NSIS对话框页面中添加自定义标签,有条件地在NSIS MUI目录页面中显示和隐藏标签,以及如何获取标签ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆