NSIS自定义页面MessageBox跳转到下一页

NSIS自定义页面MessageBox跳转到下一页,nsis,Nsis,页面自定义模式页面创建模式页面离开 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: ca

页面自定义模式页面创建模式页面离开

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
我有一个自定义页面,在这个页面中,当用户从自定义页面单击下一步时,我想显示一个消息框

现在单击“下一步”消息框出现,并接受用户的确认。然后,若用户单击“是”,则应转到下一页,若单击“否”,则应保持在同一自定义页上


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

来自文档:

leave函数允许您使用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

关于您未来的评论,请添加一些解释
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
        abort

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