【问题标题】:Can't find IDOK (1) in the custom UI! How to add a custom OK Button in NSIS?在自定义 UI 中找不到 IDOK (1)!如何在 NSIS 中添加自定义 OK 按钮?
【发布时间】:2013-06-20 14:35:59
【问题描述】:

请帮忙!在 NSIS 中,我正在使用

!define MUI_PAGE_CUSTOMFUNCTION_SHOW LicenseShow

然后

Function LicenseShow

  ; New dialog for custom items
  nsDialogs::Create 1018
  Pop $0

  ; Accept button
  ${NSD_CreateButton} 373, 223, 50, 14 "Accept"  ; Can't find IDOK (1) in the custom UI! 

  ; Decline button
  ${NSD_CreateButton} 21, 223, 50, 14 "Decline"

  ; Picture
  ${NSD_CreateBitmap} 5 5 100% 100 "disclosure.bmp"
  Pop $0
  ${NSD_SetImage} $0 $PLUGINSDIR\image.bmp $ImageHandle

  ; Disclaimer
  nsDialogs::CreateControl /NOUNLOAD ${__NSD_Text_CLASS} ${DEFAULT_STYLES}|${WS_TABSTOP}|${ES_WANTRETURN}|${ES_MULTILINE} ${__NSD_Text_EXSTYLE} 5 220 660 115 ''
  Pop $1
  SendMessage $1 ${EM_SETREADONLY} 1 0
  SetCtlColors $1 0x000000 0xFFFFFF
  ${NSD_SetText} $1 "The license text"

  nsDialogs::Show
  ${NSD_FreeImage} $ImageHandle

FunctionEnd

如何判断Accept按钮上有IDOK?

请帮忙。

【问题讨论】:

    标签: user-interface dialog controls custom-controls nsis


    【解决方案1】:

    你可以通过调用System::Call 'user32::SetWindowLong(i $myhwnd,i -12,i $mynewid)'来设置id,但你真正应该做的是设置回调函数:

    ...
    ${NSD_CreateButton} ...
    pop $0
    ${NSD_OnClick} $0 userclicked
    ...
    Function userclicked
    MessageBox mb_ok Hello
    SendMessage $hwndparent ${WM_COMMAND} 1 0
    FunctionEnd
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-03-13
      • 1970-01-01
      相关资源
      最近更新 更多