NSIS的进度栏位置

时间:2012-10-16 13:19:50

标签: progress-bar nsis

如何在安装页面上更改进度条位置并将其放在表单的中心而不是默认的顶部位置?

1 个答案:

答案 0 :(得分:1)

A)使用Resource Hacker修改其中一个用户界面文件并将其应用于ChangeUI

B)在运行时更改它:

outfile "$%temp%\test.exe"
requestexecutionlevel user
showinstdetails nevershow

Page instfiles "" instfilesshow

Function instfilesshow
FindWindow $9 "#32770" "" $HWNDPARENT
GetDlgItem $8 $9 0x3EC
System::Call '*(i,i,i,i)i.r7' ; Allocate a RECT struct
System::Call 'USER32::GetClientRect(ir9,ir7)'
System::Call '*$7(i,i,i.r0,i.r1)' ; Get inner dialog width/height
System::Call 'USER32::GetWindowRect(ir8,ir7)'
System::Call '*$7(i.r2,i.r3,i.r4,i.r5)'
System::Free $7
IntOp $5 $5 - $3 ; progress height
StrCpy $2 10 ; left padding
IntOp $4 $0 - 20 ; width = dialog - left+right padding
IntOp $0 $5 / 2
IntOp $1 $1 / 2
IntOp $1 $1 - $0
!define SWP_NOZORDER 4
System::Call 'USER32::SetWindowPos(ir8,i0,ir2,ir1,ir4,ir5,i${SWP_NOZORDER})'
FunctionEnd

Section
SectionEnd