简体   繁体   English

添加到MUI_PAGE_INSTFILES的链接不显示

[英]Added link to MUI_PAGE_INSTFILES does not show

I'm trying to create a downloader that also has a "Download manually" link, but the link does not seem to show. 我正在尝试创建一个也具有“手动下载”链接的下载程序,但是该链接似乎没有显示。 对话框控件

I tried to follow instructions from this post but can't seem to make it work. 我试图按照这篇文章中的说明进行操作,但似乎无法使其正常工作。

I'm copying the script here in case anyone can point out what I might be missing - I'm a noob in NSIS scripting, sorry. 我在这里复制脚本,以防有人指出我可能缺少的内容-抱歉,我是NSIS脚本的菜鸟。

!include "MUI2.nsh"
!define NAME "instfileslink"
Name "${NAME}"
OutFile "${NAME}.exe"

!define MUI_PAGE_CUSTOMFUNCTION_SHOW MyInstFilesShow
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_LANGUAGE "English"

Var hCtl_test_Link1

Section
    Section
    inetc::get /caption "Downloading package" "http://speedtest.ftp.otenet.gr/files/test100Mb.db" "test100Mb.db" /end   
    Pop $R0
    StrCmp $R0 "OK" 0 dlfailed  
    Quit    
dlfailed:
    DetailPrint "Download failed: $R0"
    Abort   
SectionEnd

Function fnLinkClicked
    ExecShell "open" "http://speedtest.ftp.otenet.gr/files/test100Mb.db"
FunctionEnd

Function MyInstFilesShow
    ${NSD_CreateLink} 120u 175u 100% 10u "Download manually"
    Pop $hCtl_test_Link1
    ${NSD_OnClick} $hCtl_test_Link1 fnLinkClicked
FunctionEnd

You cannot use NSDialogs controls ( ${NSD_Create*} ) outside a NSDialogs dialog! 您不能在NSDialogs对话框之外使用NSDialogs控件( ${NSD_Create*} )!

You can use ChangeUI / MUI_UI to add controls to a built-in page or you can add the dynamically at run-time by manually creating a window. 您可以使用ChangeUI / MUI_UI将控件添加到内置页面,也可以在运行时通过手动创建窗口来动态添加控件。 You need to use the ButtonEvent plug-in to catch the click events: 您需要使用ButtonEvent插件来捕获click事件:

!include "MUI2.nsh"

!define MUI_PAGE_CUSTOMFUNCTION_SHOW MyInstFilesShow
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_LANGUAGE "English"

!include nsDialogs.nsh ; For style defines
ShowInstDetails hide
Function MyInstFilesShow
  FindWindow $0 "#32770" "" $HWNDPARENT ; Find the inner dialog
  System::Call 'USER32::CreateWindowEx(i0, t "STATIC", t "Download manually", i${WS_CHILD}|${WS_VISIBLE}|${SS_NOTIFY}, i 100, i 200, i 300, i 50, p $0, i 0x666, p 0, p 0)p.s'
  Pop $0
  SetCtlColors $0 0000ff transparent 
  SendMessage $hwndparent ${WM_GETFONT} 0 0 $1
  SendMessage $0 ${WM_SETFONT} $1 1
  GetFunctionAddress $1 fnLinkClicked
  ButtonEvent::AddEventHandler 0x666 $1
FunctionEnd

Function fnLinkClicked
  ExecShell "open" "http://speedtest.ftp.otenet.gr/files/test100Mb.db"
FunctionEnd

暂无
暂无

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

相关问题 NSIS如何在安装过程中修改MUI_PAGE_INSTFILES? - NSIS How to modify MUI_PAGE_INSTFILES during installtion? 如何调整NSIS MUI_PAGE_INSTFILES中的节的列表框的大小 - How to resize the list box of sections in NSIS MUI_PAGE_INSTFILES 如何在NSIS中的MUI_PAGE_INSTFILES上显示自定义文本 - How to display a custom text on MUI_PAGE_INSTFILES in NSIS 如何在NSIS中设置MUI_PAGE_INSTFILES的位置? - How to set position of MUI_PAGE_INSTFILES in NSIS? 如果存在两个MUI_PAGE_INSTFILES,如何更改MUI_INSTFILESPAGE_FINISHHEADER_SUBTEXT - How to change MUI_INSTFILESPAGE_FINISHHEADER_SUBTEXT if exists two MUI_PAGE_INSTFILES NSIS:当MUI_PAGE_INSTFILES完成时,如何自动按“下一步”按钮 - NSIS: How to press “Next” button automatically when MUI_PAGE_INSTFILES is complete 为什么当我添加自定义 nsDialog 页面时,我的 NSIS 脚本似乎跳过了 MUI_PAGE_INSTFILES 等安装页面? - Why does my NSIS script appear to be skipping over installation pages like MUI_PAGE_INSTFILES when I add custom nsDialog pages? 如何在MUI instfiles页面中更改进度栏长度并安排按钮位置? - How to change Progress bar length in MUI instfiles page and arrange button position? 模拟下一次单击 INSTFILES 页面以将用户带到自定义页面 (NSIS) - Simulate next click on INSTFILES page to take user to a Custom Page (NSIS) !define MUI_PAGE_DIRECTORY_VARIABLE不创建变量-NSIS - !define MUI_PAGE_DIRECTORY_VARIABLE does not create variable - NSIS
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM