单击添加按钮上的跳过页面

时间:2018-08-13 13:57:38

标签: nsis

我有另一个post的添加按钮:

GetDlgItem $0 $hwndparent 2 ; Find cancel button
System::Call *(i,i,i,i)i.r1
System::Call 'USER32::GetWindowRect(ir0,ir1)'
System::Call *$1(i.r2,i.r3,i.r4,i.r5)
IntOp $5 $5 - $3 ;height
IntOp $4 $4 - $2 ;width
System::Call 'USER32::ScreenToClient(i$hwndparent,ir1)'
System::Call *$1(i.r2,i.r3)
System::Free $1
IntOp $2 $2 + $4 ;x
IntOp $2 $2 + 8  ;x+padding
System::Call 'USER32::CreateWindowEx(i0,t "Button",t "Skip",i${WS_CHILD}|${WS_VISIBLE}|${WS_TABSTOP},i 170,i 327,ir4,ir5,i $hwndparent,i 0x666,i0,i0)i.r0'
SendMessage $hwndparent ${WM_GETFONT} 0 0 $1
SendMessage $0 ${WM_SETFONT} $1 1

GetFunctionAddress $0 onmybtnclick
ButtonEvent::AddEventHandler 0x666 $0

我将其放在自定义页面函数中,并将其放置为这样显示:
skip button
一切工作正常,除了我希望此按钮用作跳至我有序的下一个自定义页面的功能。
我试图获取窗口并向其发送NEXT命令,试图调用自定义页面函数,甚至尝试从this url调用全局标签,并且尝试从几乎每一行代码中调用Abort到达。
我仍然缺少某些东西,而Google结果全变成紫色。我需要一种基于单击即可跳至下一页的方法,并且此按钮必须位于Back按钮旁边。

1 个答案:

答案 0 :(得分:0)

从文档中:

  

使用功能前功能,您可以使用“中止”跳过页面。

!include nsDialogs.nsh
!include WinMessages.nsh
!include LogicLib.nsh

Page Custom Page1
Page Custom Page2
Page Directory
Page InstFiles

Var SkipPage2

Function onmybtnclick
StrCpy $SkipPage2 1 ; Set flag so the next page knows to skip itself 
SendMessage $HWNDPARENT ${WM_COMMAND} 1 0 ; Click next button
FunctionEnd

Function Page1
    StrCpy $SkipPage2 0 ; Reset
    nsDialogs::Create 1018
    Pop $0

    ${NSD_CreateButton} 0 30u 100% 10u "&Skip next page"
    Pop $0
    ${NSD_OnClick} $0 onmybtnclick
    nsDialogs::Show
FunctionEnd

Function Page2
${If} $SkipPage2 <> 0
    Abort
${EndIf}
nsDialogs::Create 1018
Pop $0
${NSD_CreateLabel} 0 0 100% 12u "I was not skipped"
Pop $0
nsDialogs::Show
FunctionEnd
相关问题