#RequireAdmin
#PRE_UseUpx=n
#PRE_Res_Fileversion=2.1.2.17
#PRE_Res_Fileversion_AutoIncrement=y
#PRE_Run_Tidy=y
Global $ProgName = "我的程序", $ProgTitle = "MyPrograme"
Global $hGui, $hGuiHelp, $hGuiAbout
Opt('GUIOnEventMode', 1)
Opt('TrayOnEventMode', 1)
Opt('TrayMenuMode', 1 + 2)
TraySetClick(2)
$MenuItem_Reg = TrayCreateItem("注册(&R)")
TrayItemSetOnEvent(-1, '_GuiShow')
$MenuItem_Help = TrayCreateItem("帮助(&H)")
TrayItemSetOnEvent(-1, '_GuiShow')
$MenuItem_About = TrayCreateItem("关于(&A)")
TrayItemSetOnEvent(-1, '_GuiShow')
TrayCreateItem("")
$MenuItem_Exit = TrayCreateItem("退出(&E)" & @TAB & "Ctrl+Alt+X")
TrayItemSetOnEvent(-1, '_ExitProgram')
TraySetIcon(@ScriptName, "201")
_GUICreateAll()
While 1
Sleep(1000)
WEnd
Func _GUICreateAll()
$hGui = GUICreate($ProgTitle & " - 注册", 290, 200, -1, -1, 0x00080000)
GUISetOnEvent(-3, '_GuiClose')
GUICtrlCreateLabel("注册后才可使用全部功能哦,亲!", 17, 15, 260)
GUICtrlCreateLabel("请填写正确的注册码以注册本程序。", 17, 30, 260)
GUICtrlCreateLabel("机器码", 20, 64, 40)
$MachineNumInput = GUICtrlCreateInput("ABCD", 60, 60, 185, 21, 0x0800)
GUICtrlCreateLabel("注册码", 20, 96, 40)
$RegisterNum = GUICtrlCreateInput("", 60, 91, 185, 21)
$RegButton = GUICtrlCreateButton("注册(&R)", 105, 125, 80)
GUICtrlSetOnEvent(-1, '_Register')
GUICtrlSetState($RegButton, 512)
$hGuiHelp = GUICreate($ProgTitle & " - 帮助", 220, 160, -1, -1, 0x00080000)
GUISetOnEvent(-3, '_GuiClose')
GUICtrlCreateIcon(@ScriptName, 0, 20, 20, 32, 32)
$OkButton = GUICtrlCreateButton("确定(&O)", 70, 70, 80)
GUICtrlSetOnEvent(-1, '_GuiClose')
$hGuiAbout = GUICreate($ProgTitle & " - 关于", 300, 160, -1, -1, 0x00080000)
GUISetOnEvent(-3, '_GuiClose')
GUICtrlCreateLabel($ProgName & " (Ver " & FileGetVersion(@ScriptName) & ")", 50, 20)
EndFunc ;==>_GUICreateAll
Func _GuiClose()
GUISetState(0, @GUI_WinHandle)
EndFunc ;==>_GuiClose
Func _GuiShow()
Switch @TRAY_ID
Case $MenuItem_Reg
GUISetState(1, $hGui)
Case $MenuItem_Help
GUISetState(1, $hGuiHelp)
Case $MenuItem_About
GUISetState(1, $hGuiAbout)
EndSwitch
EndFunc ;==>_GuiShow
Func _Register()
MsgBox(64, $ProgTitle & " - 注册", "恭喜,注册成功!", 0, $hGui)
EndFunc ;==>_Register
Func _ExitProgram()
Exit
EndFunc ;==>_ExitProgram