NSIS Custom Page MessageBox跳转到下一页

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

页面自定义ModePageCreate ModePageLeave

Function ModePageLeave
    MessageBox MB_YESNO "Installer is now going to uninstall existing software and reinstall software. Database files will be removed. Please confirm to proceed!" IDYES true IDNO false
        true:
        call silentUninst

        false:
        System::Call 'USER32::PostMessage(i$HWNDPARENT,i0x408,i-1,i0)'
        #Abort
FunctionEnd

我有一个自定义页面,在此我想在用户点击下一个(自定义页面旁边)时显示一个消息框

现在点击下一个消息框出现并接受用户的确认。然后,如果用户单击是,则应转到下一页,如果否,则应保留在同一自定义页面上。

使用此代码,我将获得相同的自定义页面,无论是否单击是或否。每次我只坚持自定义页面。

nsis
1个回答
1
投票

从文档:

离开功能允许您强制用户使用Abort停留在当前页面上。

您的代码始终执行false:部分。

你可以改成它

Function ModePageLeave
    MessageBox MB_YESNO "Something?" IDYES true IDNO false
        true:
        call silentUninst
        goto done

        false:
        System::Call 'USER32::PostMessage(i$HWNDPARENT,i0x408,i-1,i0)'
        done:
FunctionEnd

但使用官方方法要好得多:

Page Components
Page Custom myPageCreate myPageLeave
Page Directory
Page Instfiles

Function myPageCreate
nsDialogs::Create 1018
Pop $0
nsDialogs::Show
FunctionEnd

Function myPageLeave
MessageBox MB_YESNO "Something?" IDYES goNext
  Abort ; Stay on page
goNext:
FunctionEnd
© www.soinside.com 2019 - 2024. All rights reserved.