example.nsi 1.3 KB

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