使用StdUtils实现任务栏和开始菜单锁定解锁程序图
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 | ;少轻狂据英文例子改写,专给新手参考。WIN10(含)以下测试通过。 ;NSIS中文论坛www.nsisfans.com Caption "InvokeShellVerb" OutFile "InvokeShellVerb.exe" !addincludedir "..\..\Include" !include 'StdUtils.nsh' RequestExecutionLevel user ShowInstDetails show Section "任务栏锁定" ${StdUtils.InvokeShellVerb} $0 "$SYSDIR" "mspaint.exe" ${StdUtils.Const.ShellVerb.PinToTaskbar} StrCmp "$0" "ok" 0 +3 MessageBox MB_TOPMOST "任务栏锁定成功!" Goto +2 MessageBox MB_TOPMOST "任务栏锁定失败!" SectionEnd Section "任务栏解锁" ${StdUtils.InvokeShellVerb} $0 "$SYSDIR" "mspaint.exe" ${StdUtils.Const.ShellVerb.UnpinFromTaskbar} StrCmp "$0" "ok" 0 +3 MessageBox MB_TOPMOST "任务栏解锁成功!" Goto +2 MessageBox MB_TOPMOST "任务栏解锁失败!" SectionEnd Section "开始菜单锁定" ${StdUtils.InvokeShellVerb} $0 "$SYSDIR" "mspaint.exe" ${StdUtils.Const.ShellVerb.PinToStart} StrCmp "$0" "ok" 0 +3 MessageBox MB_TOPMOST "开始菜单锁定成功!" Goto +2 MessageBox MB_TOPMOST "开始菜单锁定失败!" SectionEnd Section "开始菜单解锁" ${StdUtils.InvokeShellVerb} $0 "$SYSDIR" "mspaint.exe" ${StdUtils.Const.ShellVerb.UnpinFromStart} StrCmp "$0" "ok" 0 +3 MessageBox MB_TOPMOST "开始菜单解锁成功!" Goto +2 MessageBox MB_TOPMOST "开始菜单解锁失败!" SectionEnd |
文章来源:nsisfans