!include "LogicLib.nsh"
SetCompressor lzma
XPStyle on
OutFile "Two_Tiger.exe"
Name "两只老虎"
Var RetVar
!define Return `!insertmacro Return`
!macro Return Ret
StrCpy $RetVar "${Ret}"
Goto ReturnPre
!macroend
!define frequency `!insertmacro frequency`
!macro frequency scale melody
Push ${melody}
Push ${scale}
Call frequency
!macroend
Function frequency
Exch $0
Exch
Exch $1
StrCpy $RetVar ""
${IfThen} $0 == "0" ${|} ${Return} 0 ${|}
${If} $1 == "C"
${Switch} $0
${Case} "1"
${Return} 264
${Case} "2"
${Return} 297
${Case} "3"
${Return} 330
${Case} "4"
${Return} 352
${Case} "5"
${Return} 396
${Case} "6"
${Return} 440
${Case} "7"
${Return} 495
${EndSwitch}
${ElseIf} $1 == "D"
${Switch} $0
${Case} "1"
${Return} 297
${Case} "2"
${Return} 334
${Case} "3"
${Return} 371
${Case} "4"
${Return} 396
${Case} "5"
${Return} 446
${Case} "6"
${Return} 495
${Case} "7"
${Return} 557
${EndSwitch}
${EndIf}
SetErrors
ReturnPre:
Pop $1
Pop $0
FunctionEnd
!define book `!insertmacro book`
!macro book book speed melody
System::Call `*(t"${book}", i${speed}, t"${melody}")i.s`
Call book
!macroend
Function book
Exch $0
Push $1
Push $2
Push $3
Push $4
Push $5
Push $6
Push $7
System::Call "*$0(t.r1, i.r2, t.r3)"
System::Free $0
StrLen $4 $1
${For} $0 1 $4
StrCpy $5 $1 1 $0
${frequency} $5 $3
${IfThen} ${Errors} ${|} ${Continue} ${|}
StrCpy $6 $2
IntOp $7 $0 + 1
StrCpy $7 $1 1 $7
${Switch} $7
${Case} "H"
${frequency} $5 $3
IntOp $RetVar $RetVar * 2
${Break}
${Case} "L"
${frequency} $5 $3
IntOp $RetVar $RetVar / 2
${Break}
${Case} "Q"
IntOp $6 $2 / 2
${Break}
${Case} "S"
IntOp $6 $2 * 2
${EndSwitch}
${If} $RetVar = 0
Sleep $2
${Else}
System::Call Kernel32::Beep(i$RetVar,ir6)
${EndIf}
${Next}
Pop $7
Pop $6
Pop $5
Pop $4
Pop $3
Pop $2
Pop $1
Pop $0
FunctionEnd
Section
${book} "12311231345034505Q6Q5Q4Q315Q6Q5Q4Q3126L1026L1" 300 "D"
SectionEnd
© 版权声明
THE END
暂无评论内容