example.nsi 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. !include nsDialogs.nsh
  2. !include LogicLib.nsh
  3. Name "nsDialogs Example"
  4. OutFile "nsDialogs Example.exe"
  5. XPStyle on
  6. Page license
  7. Page custom nsDialogsPage
  8. Var BUTTON
  9. Var EDIT
  10. Var CHECKBOX
  11. Function nsDialogsPage
  12. nsDialogs::Create 1018
  13. Pop $0
  14. GetFunctionAddress $0 OnBack
  15. nsDialogs::OnBack $0
  16. ${NSD_CreateButton} 0 0 100% 12u Test
  17. Pop $BUTTON
  18. GetFunctionAddress $0 OnClick
  19. nsDialogs::OnClick $BUTTON $0
  20. ${NSD_CreateText} 0 35 100% 12u hello
  21. Pop $EDIT
  22. GetFunctionAddress $0 OnChange
  23. nsDialogs::OnChange $EDIT $0
  24. ${NSD_CreateCheckbox} 0 -50 100% 8u Test
  25. Pop $CHECKBOX
  26. GetFunctionAddress $0 OnCheckbox
  27. nsDialogs::OnClick $CHECKBOX $0
  28. ${NSD_CreateLabel} 0 40u 75% 40u "* Type `hello there` above.$\n* Click the button.$\n* Check the checkbox.$\n* Hit the Back button."
  29. Pop $0
  30. nsDialogs::Show
  31. FunctionEnd
  32. Function OnClick
  33. Pop $0 # HWND
  34. MessageBox MB_OK clicky
  35. FunctionEnd
  36. Function OnChange
  37. Pop $0 # HWND
  38. System::Call user32::GetWindowText(i$EDIT,t.r0,i${NSIS_MAX_STRLEN})
  39. ${If} $0 == "hello there"
  40. MessageBox MB_OK "right back at ya"
  41. ${EndIf}
  42. FunctionEnd
  43. Function OnBack
  44. MessageBox MB_YESNO "are you sure?" IDYES +2
  45. Abort
  46. FunctionEnd
  47. Function OnCheckbox
  48. Pop $0 # HWND
  49. MessageBox MB_OK "checkbox clicked"
  50. FunctionEnd
  51. Section
  52. SectionEnd