NSIS隐藏桌面
下午在网上闲逛发现了一段代码,
刷新桌面用的,当时觉得可以利用nsis现有命令再结合API来实现,翻了些资料,终于搞定,同时结合查找到的桌面句柄,写了一个隐藏桌面的小玩意娱乐下。
完整脚本:
!include nsDialogs.nsh
XPStyle on
ChangeUI all '${NSISDIR}\Contrib\UIs\sdbarker_tiny.exe'
Name 隐藏桌面
OutFile 隐藏桌面.exe
Page custom HideDesktop
Function HideDesktop
nsDialogs::Create /NOUNLOAD 1018
Pop $0
${NSD_CreateButton} 40 60 70 40 "隐藏桌面"
pop $1
${NSD_OnClick} $1 OnButton
${NSD_CreateButton} 280 60 70 40 "显示桌面"
pop $1
${NSD_OnClick} $1 OnButton
${NSD_CreateLabel} 140 70 100% 100u "无聊制作,纯属恶搞。"
Pop $7
nsDialogs::Show
FunctionEnd
Section ""
SectionEnd
Function OnButton
Pop $1 # HWND
FindWindow $4 "Progman" "Program Manager"
FindWindow $5 "SHELLDLL_DefView" "" $4 0
FindWindow $6 "SysListView32" "" $5 0
${NSD_GetText} $1 $3
${If} $3 == "隐藏桌面"
ShowWindow $6 0
${ElseIf} $3 == "显示桌面"
ShowWindow $6 1
${EndIf}
System::Call "user32.dll::PostMessage(i$6, i256, i0x74, i0)"
System::Call "user32.dll::PostMessage(i$6, i257, i0x74, i1)" #刷新下桌面
FunctionEnd
本文来自博客园,作者:水晶石,转载请注明原文链接:https://www.cnblogs.com/NSIS/p/16581139.html