最新消息:

nsDialogs如何使控件显示或隐藏

nsis 永恒心锁 1834浏览 0评论
;NSDialogs 允许使用 ${NSD_Create*} 创建控件并返回 HWND 值到堆栈,这样我们很方便就可以对控件进行设置可用或不可用,当然我们这里要使用NSIS里的ShowWindow 命令。

!include "nsDialogs.nsh"
!include "winmessages.nsh"
!include "logiclib.nsh"
Caption "如何使控件显示或隐藏"
OutFile "pythonschool.exe"
loadlanguagefile "${NSISDIR}ContribLanguage filessimpChinese.nlf"
Page Custom pre
var dialog
var hwnd
var button
Function pre
 nsDialogs::Create 1018
 Pop $dialog
 ${NSD_CreateCheckbox} 0 0 50% 6% "显示/隐藏按钮"
 Pop $hwnd
 ${NSD_OnClick} $hwnd EnDisableButton
 ${NSD_CreateButton} 25% 25% 50% 50% "python丝酷网"
 Pop $button
 ShowWindow $button ${SW_HIDE} # 开始状态为隐藏 SW_HIDE
 nsDialogs::Show
FunctionEnd
Function EnDisableButton
 Pop $hwnd
 ${NSD_GetState} $hwnd $0
 ${If} $0 == 1
 ShowWindow $button ${SW_SHOW}
 ${Else}
 ShowWindow $button ${SW_HIDE}
 ${EndIf}
FunctionEnd
Section ""
SectionEnd

!include "nsDialogs.nsh"
!include "winmessages.nsh"
!include "logiclib.nsh"
Caption "如何使控件显示或隐藏"
OutFile "pythonschool.exe"
loadlanguagefile "${NSISDIR}ContribLanguage filessimpChinese.nlf"
Page Custom pre
var dialog
var hwnd
var button
Function pre
 nsDialogs::Create 1018
 Pop $dialog
 ${NSD_CreateCheckbox} 0 0 50% 6% "显示/隐藏按钮"
 Pop $hwnd
 ${NSD_OnClick} $hwnd EnDisableButton
 ${NSD_CreateButton} 25% 25% 50% 50% "python丝酷网"
 Pop $button
 ${NSD_OnClick} $button OpenURL
 ShowWindow $button ${SW_HIDE} # 开始状态为隐藏 SW_HIDE
 nsDialogs::Show
FunctionEnd
Function EnDisableButton
 Pop $hwnd
 ${NSD_GetState} $hwnd $0
 ${If} $0 == 1
 ShowWindow $button ${SW_SHOW}
 ${Else}
 ShowWindow $button ${SW_HIDE}
 ${EndIf}
FunctionEnd
Function OpenURL
 Pop $button
 ExecShell open "http://www.yhxs3344.net"
FunctionEnd
Section ""
SectionEnd
永恒心锁,版权所有丨如未注明,均为转载丨本网站采用BY-NC-SA协议进行授权

转载请注明:永恒心锁-分享互联网 » nsDialogs如何使控件显示或隐藏

您必须 登录 才能发表评论!