添加 link 到中止页面
Add link to Abort page
作为 , I'm trying to add the link after issuing Abort command, but for some reason it does not appear, no trace of it when viewed in Spy++.
的后续行动
想法是在进度条上面加上link,但是不知为何宏不起作用。是否有我遗漏的原因,是否可以在调用 Abort 后添加 link?我在某处读到 Abort 命令可以产生不同的效果,所以我猜这是其中之一。
我已尽力使这个示例脚本尽可能简洁,并且非常感谢任何帮助,因为我仍在学习 NSIS。
!include "MUI2.nsh"
;--------------------------------
;General
ShowInstDetails hide
SetCompressor /SOLID lzma
;Request application privileges for Windows Vista
RequestExecutionLevel user
;--------------------------------
;Interface Configuration
!define MUI_ABORTWARNING
!define MANUAL_DOWNLOAD_TEXT "Automatic download not working? Click here to download manually."
;--------------------------------
;Macros
!macro AddDownloadLink yCoord
FindWindow [=11=] "#32770" "" $HWNDPARENT ; Find the inner dialog
System::Call 'USER32::CreateWindowEx(i0, t "STATIC", t "${MANUAL_DOWNLOAD_TEXT}", i${WS_CHILD}|${WS_VISIBLE}|${SS_NOTIFY}, i 1, i ${yCoord}, i 500, i 50, p [=11=], i 0x666, p 0, p 0)p.s'
Pop [=11=]
SetCtlColors [=11=] 0000ff transparent
CreateFont "$(^Font)" "$(^FontSize)" "400" /UNDERLINE
SendMessage [=11=] ${WM_SETFONT} 1
GetFunctionAddress fnLinkClicked
ButtonEvent::AddEventHandler 0x666
!macroend
;--------------------------------
;Pages
!insertmacro MUI_PAGE_INSTFILES
;--------------------------------
;Languages
!insertmacro MUI_LANGUAGE "English"
;--------------------------------
;Installer Sections
Section
Var /global Filename
StrCpy $Filename "test100Mb.db"
Var /global DownloadUrl
StrCpy $DownloadUrl "http://speedtest.ftp.otenet.gr/files/$Filename"
!insertmacro AddDownloadLink 70
inetc::get /caption "Downloading package" $DownloadUrl "$Filename" /end
Pop $R0 ;Get the return value
StrCmp $R0 "OK" 0 dlfailed
Goto quit
dlfailed:
DetailPrint "Download failed: $R0 $DownloadUrl"
SetDetailsView show
Abort
!insertmacro AddDownloadLink 1
quit:
Quit
SectionEnd
Function fnLinkClicked
ExecShell "open" "$DownloadUrl"
FunctionEnd
Abort
停止执行部分代码,您必须在调用 Abort
.
之前做任何您需要做的事情
在节中添加控件可能会出现问题,因为它在不同的线程上执行并且 windows 与创建它们的线程相关联。如果您需要 window 停留的时间比安装线程长,您可以在 instfiles 页面显示回调中将其创建为隐藏的 window 并在需要时简单地在该部分中调用 ShowWindow
显示它...
作为
想法是在进度条上面加上link,但是不知为何宏不起作用。是否有我遗漏的原因,是否可以在调用 Abort 后添加 link?我在某处读到 Abort 命令可以产生不同的效果,所以我猜这是其中之一。
我已尽力使这个示例脚本尽可能简洁,并且非常感谢任何帮助,因为我仍在学习 NSIS。
!include "MUI2.nsh"
;--------------------------------
;General
ShowInstDetails hide
SetCompressor /SOLID lzma
;Request application privileges for Windows Vista
RequestExecutionLevel user
;--------------------------------
;Interface Configuration
!define MUI_ABORTWARNING
!define MANUAL_DOWNLOAD_TEXT "Automatic download not working? Click here to download manually."
;--------------------------------
;Macros
!macro AddDownloadLink yCoord
FindWindow [=11=] "#32770" "" $HWNDPARENT ; Find the inner dialog
System::Call 'USER32::CreateWindowEx(i0, t "STATIC", t "${MANUAL_DOWNLOAD_TEXT}", i${WS_CHILD}|${WS_VISIBLE}|${SS_NOTIFY}, i 1, i ${yCoord}, i 500, i 50, p [=11=], i 0x666, p 0, p 0)p.s'
Pop [=11=]
SetCtlColors [=11=] 0000ff transparent
CreateFont "$(^Font)" "$(^FontSize)" "400" /UNDERLINE
SendMessage [=11=] ${WM_SETFONT} 1
GetFunctionAddress fnLinkClicked
ButtonEvent::AddEventHandler 0x666
!macroend
;--------------------------------
;Pages
!insertmacro MUI_PAGE_INSTFILES
;--------------------------------
;Languages
!insertmacro MUI_LANGUAGE "English"
;--------------------------------
;Installer Sections
Section
Var /global Filename
StrCpy $Filename "test100Mb.db"
Var /global DownloadUrl
StrCpy $DownloadUrl "http://speedtest.ftp.otenet.gr/files/$Filename"
!insertmacro AddDownloadLink 70
inetc::get /caption "Downloading package" $DownloadUrl "$Filename" /end
Pop $R0 ;Get the return value
StrCmp $R0 "OK" 0 dlfailed
Goto quit
dlfailed:
DetailPrint "Download failed: $R0 $DownloadUrl"
SetDetailsView show
Abort
!insertmacro AddDownloadLink 1
quit:
Quit
SectionEnd
Function fnLinkClicked
ExecShell "open" "$DownloadUrl"
FunctionEnd
Abort
停止执行部分代码,您必须在调用 Abort
.
在节中添加控件可能会出现问题,因为它在不同的线程上执行并且 windows 与创建它们的线程相关联。如果您需要 window 停留的时间比安装线程长,您可以在 instfiles 页面显示回调中将其创建为隐藏的 window 并在需要时简单地在该部分中调用 ShowWindow
显示它...