如何使用 NSIS 制作一个可以立即解压并运行文件的安装程序?

问题描述 投票:0回答:1

如何使用 NSIS 制作这样的安装程序?启动后,应用程序立即解压并启动。是否有任何 nsis 脚本可以创建类似的东西?这不是我第一次看到这种风格的安装程序。

示例1:

example 1

示例2:

example 2

示例3:

example 3

我确信这是

NSIS
,因为exe内部(如果你查看7zip)有这样的文件和文件夹,而这样的文件和文件夹只存在于
NSIS
中。

截图1:

screenshot 1

截图2:

screenshot 2

我尝试了程序文件夹中的所有

NSIS
示例,但没有找到这样的脚本。我在谷歌上也找不到它。我也尝试过使用 INNO Setup,但意识到屏幕截图中的那些安装程序,它们是 100% 通过
NSIS
制作的。

windows-installer nsis
1个回答
0
投票

您可以在运行时调整它的大小:

RequestExecutionLevel Admin
InstallDir "$ProgramFiles\MyApp"
Name "NotAGoodIdea"
XPStyle On
ShowInstDetails NeverShow
InstProgressFlags Smooth
SubCaption 3 " "

Page InstFiles "" InitUIShow

Function InitUIShow
FindWindow $5 "#32770" "" $HWNDPARENT
FindWindow $0 "msctls_progress32" "" $5
System::Call 'USER32::GetWindowRect(pr0,@r1)'
System::Call '*$1(i,i.r2,i,i.r9)'
IntOp $7 $9 - $2
IntOp $7 $7 + 3
IntOp $6 $7 * 3
System::Call 'USER32::GetWindowRect(p$HWNDPARENT,@r1)'
System::Call '*$1(i.r1,i.r2,i.r3,i)'
!define SIZECHANGE 70
IntOp $8 $3 - $1
IntOp $9 $9 - $2
IntOp $9 $9 + ${SIZECHANGE}
System::Call 'USER32::SetWindowPos(p$HWNDPARENT,p0,i0,i0,i$8,i$9,i0x12)'
System::Call 'USER32::GetWindowRect(pr5,@r1)'
System::Call '*$1(i.r1,i.r2,i.r3,i)'
IntOp $8 $3 - $1
System::Call 'USER32::SetWindowPos(p$0,p0,i0,i$6,i$8,i$7,i0x10)'
FunctionEnd

Section
!macro PretendToDoSomething
System::Call 'KERNEL32::GetTickCount()i.r0'
IntOp $0 $0 & 0xff
DetailPrint "Operation $0"
Sleep 1000
!macroend
!insertmacro PretendToDoSomething
!insertmacro PretendToDoSomething
!insertmacro PretendToDoSomething
!insertmacro PretendToDoSomething
!insertmacro PretendToDoSomething
!insertmacro PretendToDoSomething
/*
Replace the above macro with:
SetOutPath $InstDir
File myapp.exe
ExecShell "" "$InstDir\myapp.exe"
*/
Quit
SectionEnd

但更改 UI 的明智方法是使用 Resource Hacker 修改

...\NSIS\Contrib\UIs
中的一个文件,并使用
ChangeUI
/
!define MUI_UI myfile.exe
应用它。

© www.soinside.com 2019 - 2024. All rights reserved.