NSIS透明渐入渐出效果,nsis,透明效果,渐隐渐显
文章转自王牌软件
站长推荐:NSetup一键部署软件
一键式完成美化安装包制作,自动增量升级,数据统计,数字签名。应对各种复杂场景,脚本模块化拆分,常规复杂的脚本代码,图形化设置。无需专业的研发经验,轻松完成项目部署。(www.nsetup.cn)
只回答业务咨询
站长推荐:NSetup一键部署软件
一键式完成美化安装包制作,自动增量升级,数据统计,数字签名。应对各种复杂场景,脚本模块化拆分,常规复杂的脚本代码,图形化设置。无需专业的研发经验,轻松完成项目部署。(www.nsetup.cn)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 |
## transparent.nsi ## ## Script write by Restools & X-Star, Mod by zhfi. ## Needs the mod version of nsdialogs.dll or installoptions.dll plugin (suppert timer function)! ## Transparent Splash effect in NSIS while run/Exit installer, only effective on windows 2k or higher. /* ## function usage: ;function SetLayeredWindowAttributes(hwnd: HWND; crKey: TColor; bAlpha: BYTE; dwFlags: DWORD): Boolean; ; external 'SetLayeredWindowAttributes@user32.dll stdcall'; ;function GetWindowLong(Wnd: HWnd; Index: Integer): Longint; ; external 'GetWindowLongA@user32.dll stdcall'; ;function SetWindowLong(Wnd: HWnd; Index: Integer; NewLong: Longint): Longint; ; external 'SetWindowLongA@user32.dll stdcall'; ; SetWindowLong(WizardForm.Handle, GWL_EXSTYLE, GetWindowLong(WizardForm.Handle, GWL_EXSTYLE) or WS_EX_LAYERED); system::call 'user32::GetWindowLong(i $HWNDPARENT, i ${GWL_EXSTYLE}) .iR0' ;messagebox mb_ok $R0 IntOp $R0 $R0 + ${WS_EX_LAYERED} system::call 'user32::SetWindowLong(i $HWNDPARENT, i ${GWL_EXSTYLE}, i R0) .iR1' ; SetLayeredWindowAttributes(WizardForm.Handle, 0, Transparent, LWA_ALPHA); system::call 'user32::SetLayeredWindowAttributes(i $HWNDPARENT, i 0, i $iTransparent, i ${LWA_ALPHA}) .iR2' */ !AddPluginDir .\ ;-------------------------------- ;定义UI版本(MUI,MUI2) !define MUI2 ;定义透明度 !define iTransparentPercent 90 Var DIALOG var iTransparent var bTransparent Name "Transparent Example" SetCompressor /SOLID lzma InstallDir $ExeDir OutFile transparent_nsis.exe !ifdef MUI2 !include MUI2.nsh Var TIMERID !else !include MUI.nsh ;定义INI文件 !define INI $PLUGINSDIR\transparent.ini !endif !include LogicLib.nsh !ifndef GWL_EXSTYLE !define GWL_EXSTYLE -20 !endif !ifndef WS_EX_LAYERED !define WS_EX_LAYERED 0x80000 !endif !ifndef LWA_ALPHA !define LWA_ALPHA 2 !endif !define MUI_CUSTOMFUNCTION_ABORT UserAbort !ifdef MUI2 Page custom nsDialogsPage !else page custom InstallOptionsPage !endif !define MUI_PAGE_CUSTOMFUNCTION_SHOW welcome_PageShow ; 欢迎页面 !insertmacro MUI_PAGE_WELCOME !insertmacro MUI_PAGE_DIRECTORY !insertmacro MUI_PAGE_INSTFILES !insertmacro MUI_PAGE_FINISH ;-------------------------------- !insertmacro MUI_LANGUAGE "SimpChinese" Section -Nil SectionEnd Function welcome_PageShow !ifdef MUI2 Pop $0 nsDialogs::KillTimer /NOUNLOAD $TIMERID !endif GetDlgItem $0 $hwndparent 3 ShowWindow $0 0 ${if} $bTransparent == 0 ${For} $R0 0 $iTransparent system::call 'user32::SetLayeredWindowAttributes(i $HWNDPARENT, i 0, i R0, i ${LWA_ALPHA}) .iR1' sleep 1 ${Next} ${endif} StrCpy $bTransparent 1 FunctionEnd Function Exit ${ForEach} $R0 $iTransparent 0 - 1 system::call 'user32::SetLayeredWindowAttributes(i $HWNDPARENT, i 0, i R0, i ${LWA_ALPHA}) .iR1' sleep 1 ${Next} FunctionEnd Function UserAbort Messagebox MB_YESNO|MB_ICONQUESTION "Are Sure you want to cancel?" IDYES +2 Abort call Exit FunctionEnd Function .onInstSuccess Messagebox MB_OK|MB_ICONINFORMATION "Install Success!" call Exit FunctionEnd Function SetWindowAttrib ${if} $bTransparent == 0 system::call 'user32::GetWindowLong(i $HWNDPARENT, i ${GWL_EXSTYLE}) .iR0' ;messagebox mb_ok $R0 IntOp $R0 $R0 + ${WS_EX_LAYERED} system::call 'user32::SetWindowLong(i $HWNDPARENT, i ${GWL_EXSTYLE}, i R0) .iR1' system::call 'user32::SetLayeredWindowAttributes(i $HWNDPARENT, i 0, i 0, i ${LWA_ALPHA}) .iR2' Pop $R2 Pop $R1 Pop $R0 ${endif} FunctionEnd !ifndef MUI2 Function InstallOptionsPage Call SetWindowAttrib InstallOptions::initDialog /NOUNLOAD ${INI} Pop $DIALOG ;如果你想做的更逼真一些,请把它仿成欢迎页面(你的初始页面)一样的 InstallOptions::Show FunctionEnd !endif !ifdef MUI2 Function OnTimer Pop $0 ;Free Timer id GetDlgItem $1 $HWNDPARENT 1 SendMessage $1 ${BM_CLICK} 0 1 FunctionEnd Function nsDialogsPage Call SetWindowAttrib nsDialogs::Create /NOUNLOAD 1018 Pop $DIALOG ;如果你想做的更逼真一些,请把它仿成欢迎页面(你的初始页面)一样的 GetFunctionAddress $0 OnTimer nsDialogs::CreateTimer /NOUNLOAD $0 10 Pop $TIMERID nsDialogs::Show FunctionEnd !endif Function .OnInit InitPluginsDir !ifndef MUI2 File /oname=${INI} "transparent.ini" !endif IntOp $iTransparent ${iTransparentPercent} * 255 IntOp $iTransparent $iTransparent / 100 StrCpy $bTransparent 0 FunctionEnd |
学习日记,兼职软件设计,软件修改,毕业设计。
本文出自 学习日记,转载时请注明出处及相应链接。
本文永久链接: https://www.softwareace.cn/?p=1258