NSIS增加关于按钮示例
侧边栏壁纸
  • 累计撰写 29 篇文章
  • 累计收到 129 条评论

NSIS增加关于按钮示例

nsisfans
2022-01-29 / 0 评论 / 198 阅读 / 正在检测是否收录...

NSIS关于按钮示例.jpg

如果是使用Unicode版的NSIS,请将此文件转为Unicode编码。

!ifdef NSIS_UNICODE
    !AddPluginDir Plugins\Unicode
!else
    !AddPluginDir Plugins
!endif
!AddIncludeDir Include

!include "MUI2.nsh"
!include "dialog.nsh"

Name "About Button Example"
OutFile AboutButton.exe
InstallDir $TEMP

RequestExecutionLevel User

!define IDC_ABOUT 1300

!define MUI_CUSTOMFUNCTION_GUIINIT onGUIInit

!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH

!insertmacro MUI_LANGUAGE "English"
!insertmacro MUI_LANGUAGE "SimpChinese"

LangString TEXT_BTN ${LANG_ENGLISH} "&About"
LangString TEXT_MSG ${LANG_ENGLISH} "This is the About Button example script!"

LangString TEXT_BTN ${LANG_SIMPCHINESE} "关于(&A)"
LangString TEXT_MSG ${LANG_SIMPCHINESE} "这是关于按钮示例脚本!"

Section Install
  Sleep 250
  Sleep 250
  Sleep 250
  Sleep 250
  Sleep 250
  Sleep 250
  Sleep 250
  Sleep 250
  Sleep 250
  Sleep 250
SectionEnd

Function onGUIInit
  System::Call `user32::SendMessage(i$HWNDPARENT,i${WM_GETFONT},i0,i0)i.s`
  System::Call `kernel32::GetModuleHandle(in)i.s`
  System::Call `*(i8,i201,i50,i14)i.R0`
  System::Call `user32::MapDialogRect(i$HWNDPARENT,iR0)`
  System::Call `*$R0(i.s,i.s,i.s,i.s)`
  System::Call `kernel32::GlobalFree(iR0)`
  System::Call `user32::CreateWindowEx(i,ts,ts,i${BS_PUSHBUTTON}|${WS_CHILD}|${WS_VISIBLE}|${WS_TABSTOP},is,is,is,is,i$HWNDPARENT,i${IDC_ABOUT},is,i)i.s` `Button` `$(TEXT_BTN)`
  System::Call `user32::SendMessage(is,i${WM_SETFONT},is,i0)`
  GetFunctionAddress $R0 FuncAbout
  ButtonEvent::AddEventHandler /NOUNLOAD ${IDC_ABOUT} $R0
FunctionEnd

Function FuncAbout
  DialogBox::Init 220 90 "关于本程序..."
  Pop $0
  ${If} $0 != error
      ${DB_AddLabel} 10 5 100 8 "这是关于按钮示例脚本!"
      Pop $1
      DialogBox::Show
    ${EndIf}
FunctionEnd

Function .onGUIEnd
  ButtonEvent::Unload
FunctionEnd

相关插件

0

评论 (0)

取消