脚本:自动应用桌面主题

优质
小牛编辑
127浏览
2023-12-01
引用 changetheme.nsi 的内容:

Name "ChangeStyleXP"
OutFile "ChangeStyleXP.exe"

!include "FileFunc.nsh"
!insertmacro GetFileName

!define BM_CLICK 0x00F5
!define WM_CLOSE 0x0010

Section
	IfFileExists "$WINDIR\Resources\Themes\Windows Classic.theme" 0 error
	ExecShell 'open' '$WINDIR\Resources\Themes\Windows Classic.theme'
	FindWindow $0 '#32770' '' $HWNDPARENT
	StrCpy $3 0

	wait:
	IntOp $3 $3 + 1
	StrCmp $3 50 error
	Sleep 100
	System::Call 'user32::GetForegroundWindow()i .r1'
	StrCmp $0 $1 wait

	System::Call 'user32::GetWindowModuleFileName(i r1, t .r2, i ${NSIS_MAX_STRLEN})'
	${GetFileName} '$2' $2
	StrCmp $2 'comctl32.dll' 0 wait

	HideWindow
	System::Call 'user32::SetWindowPos(i $1,i 0,i 0,i 0,i 0,i 0,i 0)'
	GetDlgItem $2 $1 1
	SendMessage $2 ${BM_CLICK} 0 0
  BringToFront
	MessageBox MB_OK "Success" IDOK quit

	error:
	MessageBox MB_OK "Error"

	quit:
	quit
SectionEnd