设为首页 收藏本站

NSIS中文论坛

查看: 202|回复: 1

[求助] 自定义的安装路径的效果怎么实现的呢?

[复制链接]

该用户从未签到

1

主题

4

帖子

30

积分

积分
30
发表于 2018-4-2 11:24:54 | 显示全部楼层 |阅读模式
点击自定义安装后,窗口的高度变高,再次点击后恢复原样,这种效果的思路是改变主窗口和page页的大小么?如果是的话我在点击按钮事件里面重新设置窗口的大小为什么不行呢${NSW_SetWindowSize} $HWNDPARENT 588 439,还望各位大佬指教,谢谢!
QQ截图20180402112019.png
QQ截图20180402112031.png
回复

使用道具 举报

该用户从未签到

55

主题

127

帖子

1535

积分

积分
1535
发表于 2018-4-2 22:15:30 | 显示全部楼层
Custom install

  1. # Details

  2. Name "NSIS"
  3. OutFile "NSIS.exe"
  4. InstallDir "$TEMP"

  5. # Compress

  6. SetCompressor /SOLID /FINAL lzma

  7. # RUN

  8. RequestExecutionLevel user

  9. # HIDE # SHOW

  10. ShowInstDetails hide
  11. ShowInstDetails nevershow
  12. XPStyle on

  13. # INCLUDES

  14. !include "MUI2.nsh"
  15. !include "WinCore.nsh"
  16. !include "nsDialogs.nsh"
  17. !include "LogicLib.nsh"
  18. !include "WinMessages.nsh"
  19. !include "FileFunc.nsh"

  20. # Icon & Stye

  21. BrandingText /TRIMRIGHT " "

  22. # Page

  23. !define MUI_CUSTOMFUNCTION_GUIINIT "onGuiInit"
  24. Page Custom "WelcomePageShow"
  25. Page instfiles ""

  26. # ENGLISH

  27. !insertmacro MUI_LANGUAGE "English"

  28. # onInit

  29. Function .onInit

  30. FunctionEnd

  31. Function "onGuiInit"
  32.   # System::Call user32::SetWindowLong(i$HWNDPARENT,i-16, 0x9480084C) i.R0
  33.   GetDlgItem $R0 $HWNDPARENT 1034
  34.   ShowWindow $R0 ${SW_HIDE}
  35.   GetDlgItem $R0 $HWNDPARENT 1035
  36.   ShowWindow $R0 ${SW_HIDE}
  37.   GetDlgItem $R0 $HWNDPARENT 1036
  38.   ShowWindow $R0 ${SW_HIDE}
  39.   GetDlgItem $R0 $HWNDPARENT 1037
  40.   ShowWindow $R0 ${SW_HIDE}
  41.   GetDlgItem $R0 $HWNDPARENT 1038
  42.   ShowWindow $R0 ${SW_HIDE}
  43.   GetDlgItem $R0 $HWNDPARENT 1039
  44.   ShowWindow $R0 ${SW_HIDE}
  45.   GetDlgItem $R0 $HWNDPARENT 1256
  46.   ShowWindow $R0 ${SW_HIDE}
  47.   GetDlgItem $R0 $HWNDPARENT 1028
  48.   ShowWindow $R0 ${SW_HIDE}

  49.   System::Call user32::GetSystemMetrics(i0)i.r1
  50.   System::Call user32::GetSystemMetrics(i1)i.r2
  51.   IntOp $1 $1 - 651
  52.   IntOp $1 $1 / 2
  53.   IntOp $2 $2 - 451
  54.   IntOp $2 $2 / 2
  55.   System::Call user32::MoveWindow(i$HWNDPARENT,i$1,i$2,i651,i451,1)

  56.   SetCtlColors $HWNDPARENT "0x666666" "0xFFFFFF"
  57. FunctionEnd

  58. # WELCOME

  59. Function "WelcomePageShow"

  60.   # ...:: variables ::... #

  61.   var /GLOBAL DIALOG
  62.   var /GLOBAL FONT_NAME

  63.   var /GLOBAL Btn_Custom_Install
  64.   var /GLOBAL Bool_Custom_Install

  65.   GetDlgItem $0 $HWNDPARENT 1
  66.   ShowWindow $0 ${SW_HIDE}
  67.   GetDlgItem $0 $HWNDPARENT 2
  68.   ShowWindow $0 ${SW_HIDE}
  69.   GetDlgItem $0 $HWNDPARENT 3
  70.   ShowWindow $0 ${SW_HIDE}
  71.   GetDlgItem $0 $HWNDPARENT 1990
  72.   ShowWindow $0 ${SW_HIDE}
  73.   GetDlgItem $0 $HWNDPARENT 1991
  74.   ShowWindow $0 ${SW_HIDE}
  75.   GetDlgItem $0 $HWNDPARENT 1992
  76.   ShowWindow $0 ${SW_HIDE}

  77.   System::Call user32::SetWindowPos(i$HWNDPARENT,i0,i0,i0,i651,i451,i0x0002)
  78.   nsDialogs::Create /NOUNLOAD 1044
  79.   Pop $Dialog
  80.   ${If} $Dialog == error
  81.    Abort
  82.   ${EndIf}
  83.   System::Call user32::SetWindowPos(i$Dialog,i0,i0,i0,i651,i580,i0x0002)

  84.   SetCtlColors $Dialog "0x666666" "0xFFFFFF"

  85.   # === Custom Button === #

  86.   nsDialogs::CreateControl /NOUNLOAD BUTTON 0x40000000|0x10000000|0x04000000|0x00010000 0 540 409 100 16 "Custom"
  87.   Pop $Btn_Custom_Install
  88.   Strcpy $1 $Btn_Custom_Install
  89.   GetFunctionAddress $3 ".onClick.Custom.Install"
  90.   nsDialogs::onClick /NOUNLOAD $1 $3
  91.   Strcpy $Bool_Custom_Install 0

  92.   CreateFont $FONT_NAME "Microsoft Yahei" 9 400
  93.   SendMessage $Btn_Custom_Install ${WM_SETFONT} $FONT_NAME 0

  94.   SetCtlColors $Btn_Custom_Install "0x7B8DB6" "0xFFFFFF"

  95.   nsDialogs::Show

  96. FunctionEnd

  97. # === Custom Install === #

  98. Function ".onClick.Custom.Install"
  99.   ${If} $Bool_Custom_Install == 1
  100.     IntOp $Bool_Custom_Install $Bool_Custom_Install - 1
  101.     Strcpy $1 $Btn_Custom_Install
  102.     Call ".onClick.Hide"
  103.   ${Else}
  104.     IntOp $Bool_Custom_Install $Bool_Custom_Install + 1
  105.     Strcpy $1 $Btn_Custom_Install
  106.     Call ".onClic.Show"
  107.   ${EndIf}
  108. FunctionEnd

  109. # === Show === #

  110. Function ".onClic.Show"
  111.   System::Call user32::SetWindowPos(i$HWNDPARENT,i0,i0,i0,i651,i585,i0x0002)
  112.   System::Call user32::SetWindowPos(i$Dialog,i0,i0,i0,i651,i585,i0x0002)

  113.   System::Call user32::SetWindowPos(i$Btn_Custom_Install,i0,i540,i550,i100,i16,i0x0001)
  114. FunctionEnd

  115. # === Hide === #

  116. Function ".onClick.Hide"
  117.   System::Call user32::SetWindowPos(i$HWNDPARENT,i0,i0,i0,i651,i451,i0x0002)
  118.   System::Call user32::SetWindowPos(i$Dialog,i0,i0,i0,i651,i451,i0x0002)

  119.   System::Call user32::SetWindowPos(i$Btn_Custom_Install,i0,i540,i409,i100,i16,i0x0001)
  120. FunctionEnd

  121. Section

  122. SectionEnd

  123. Function .OnGuiEnd
  124. FunctionEnd
复制代码

评分

参与人数 1金钱 +20 收起 理由
mefcl + 20

查看全部评分

回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|联系我们|NSIS中文论坛    

GMT+8, 2018-7-23 03:51 , Processed in 0.024261 second(s), 19 queries , MemCache On.

Powered by Discuz!X3.3

© 2015-2017 NSISFANS.COM

快速回复 返回顶部 返回列表