2011-11-15 316 views
0

在我的安裝程序中,我目前有「顯示詳細信息」按鈕可見,並且可以單擊該按鈕以獲取安裝詳細信息。NSIS在顯示詳細信息後隱藏詳細信息

在這裏有什麼辦法可以獲得「隱藏詳細信息」按鈕,以便能夠返回到隱藏細節的位置?

回答

1

有這個

如果你真的想要這個功能,你不介意黑客可使用此代碼(由大概按鈕浪費了太多的空間),沒有官方的支持:

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 
1

從NSIS腳本參考文檔:

4.8.1.34 ShowInstDetails

hide | show | nevershow

設置是否顯示安裝的詳細信息。可以是 '隱藏'以默認隱藏詳細信息,允許用戶查看它們, 或'show'以默認顯示它們或'nevershow',以防止用戶 看到它們。請注意,部分可以使用 SetDetailsView覆蓋此值。