繁体   English   中英

显示详细信息后NSIS隐藏详细信息

[英]NSIS Hide Details after Show Details

在我的安装程序中,我当前显示“显示详细信息”按钮,可以单击该按钮以获取安装详细信息。

有没有办法在此时获得“隐藏详细信息”按钮,以便能够返回隐藏详细信息的位置?

从NSIS脚本参考文档:

4.8.1.34 ShowInstDetails

隐藏 |显示| nevershow

设置是否显示安装的详细信息。 默认情况下可以“隐藏”以隐藏详细信息,允许用户查看它们,或者“显示”以默认显示它们,或“隐藏”,以防止用户看到它们。 请注意,部分可以使用SetDetailsView覆盖它。

对此没有官方支持(按钮可能会浪费太多空间)

如果你真的想要这个功能并且你不介意黑客,你可以使用这个代码:

Outfile test.exe
RequestExecutionLevel user
!addplugindir ".\" ;http://nsis.sourceforge.net/ButtonEvent_plug-in

!include WinMessages.nsh
!include LogicLib.nsh

Page InstFiles "" PageInstShow

!define GWLP_ID -12
!define IDC_DETAILS 0x3F8
!define IDC_SHOWDETAILS 0x403
!define IDC_MYTOGGLE 0x1000

Function MyToggleClickHandler
FindWindow $9 "#32770" "" $HWNDPARENT
GetDlgItem $8 $9 ${IDC_MYTOGGLE}
GetDlgItem $7 $9 ${IDC_DETAILS}
System::Call 'user32::IsWindowVisible(ir7)i.r0'
${If} $0 = 0
    SendMessage $9 ${WM_COMMAND} ${IDC_SHOWDETAILS} 0
    SendMessage $8 ${WM_SETTEXT} 0 "STR:Hide &details"
    ShowWindow $8 1
${Else}
    SendMessage $8 ${WM_SETTEXT} 0 "STR:$(^ShowDetailsBtn)"
    ShowWindow $7 0
${EndIf}
FunctionEnd

Function PageInstShow
FindWindow $9 "#32770" "" $HWNDPARENT
GetDlgItem $8 $9 ${IDC_SHOWDETAILS}
System::Call 'user32::SetWindowLong(ir8,i ${GWLP_ID},i ${IDC_MYTOGGLE})'
GetFunctionAddress $1 MyToggleClickHandler
ButtonEvent::AddEventHandler ${IDC_MYTOGGLE} $1
System::Call '*(i,i,i,i)i.r1'
System::Call 'user32::GetWindowRect(ir8,ir1)'
System::Call 'user32::MapWindowPoints(i0,ir9,ir1,i2)'
System::Call '*$1(i,i,i,i.r6)'
GetDlgItem $7 $9 ${IDC_DETAILS}
System::Call 'user32::GetWindowRect(ir7,ir1)'
System::Call 'user32::MapWindowPoints(i0,ir9,ir1,i2)'
System::Call '*$1(i.r2,i.r3,i.r4,i.r5)'
System::Free $1
IntOp $3 $6 + 4 ; list top = button bottom + padding
IntOp $5 $5 - $3
System::Call 'user32::SetWindowPos(ir7,i,ir2,ir3,ir4,ir5,i 0)'
FunctionEnd

Section
SectionEnd

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM