#include <ButtonConstants.au3>
#include <DateTimeConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <StaticConstants.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
#Include <GuiButton.au3>
#Include <Date.au3>
;---------------------------------------------------------------------------
$Tittle = '123'
$Form1 = GUICreate($Tittle, 275, 224, 359, 275)
GUISetBkColor(0xFFFFFF)
$Button1 = GUICtrlCreateButton("执行命令", 32, 172, 65, 25, $WS_GROUP)
$Button2 = GUICtrlCreateButton("退出程序", 176, 172, 65, 25, $WS_GROUP)
$Group1 = GUICtrlCreateGroup("123", 10, 64, 169, 93)
$Radio4 = GUICtrlCreateRadio("使用天数", 20, 132, 65, 16)
$Radio2 = GUICtrlCreateRadio("使用时间", 20, 109, 65, 16)
$Radio1 = GUICtrlCreateRadio("使用期限", 20, 86, 65, 16)
GUICtrlSetState(-1,$GUI_CHECKED)
$Input2 = GUICtrlCreateInput("", 85, 131, 30, 18,$ES_NUMBER)
$Input3 = GUICtrlCreateInput("", 85, 108, 30, 18,$ES_NUMBER)
$Year = @YEAR & '/'
$Moth = @MON & '/'
$Date = @MDAY
$Time = $Year & $Moth & $Date
$Date1 = GUICtrlCreateDate('', 85, 85, 87, 18)
$DTM_SETFORMAT_ = 0x1032
$style = "yyyy/MM/dd"
GUICtrlSendMsg($Date1, $DTM_SETFORMAT_, 0, $style)
$Label1 = GUICtrlCreateLabel("最多2年", 120, 110, 46, 17)
$Label2 = GUICtrlCreateLabel("最多366天", 120, 133, 54, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$StatusBar1 = _GUICtrlStatusBar_Create($Form1)
_GUICtrlStatusBar_SetSimple($StatusBar1)
_GUICtrlStatusBar_SetMinHeight($StatusBar1, 17)
$Tab1 = GUICtrlCreateTab(-1, 56, 390, 113)
GUICtrlSetResizing(-1, $GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
GUICtrlCreateTabItem("")
$Pic1 = GUICtrlCreatePic("C:\Documents and Settings\jevonleen\桌面\g_06_top_bg.jpg", 0, 0, 278, 50, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
GUISetState(@SW_SHOW)
$Form2 = GUICreate('123','200','200','200','200',$Form1)
IniWriteSection('c:\myfile.ini','FTIME','ftime=' & $Time);写入
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
Ms1()
Case $msg = $Button2
Ms1()
Case $msg = $Button1
GUICtrlSetState($Input2,$GUI_DISABLE)
go()
;GUISetState(@SW_SHOW,$Form2)
EndSelect
WEnd
Func Ms1()
$Ms1 = MsgBox(4+32,'提示','是否确定退出程序?')
If $Ms1 = 6 Then
Exit
EndIf
EndFunc
Func go()
$ftime = ControlGetText($Tittle,'使用期限',$Date1)
$D1 = ControlGetText($Tittle,'使用期限',$Input3)
$D2 = ControlGetText($Tittle,'使用期限',$Input2)
$D3 = $D1 * 366
If GUICtrlRead($Radio1) = $GUI_CHECKED Then
ltd1()
EndIf
If GUICtrlRead($Radio2) = $GUI_CHECKED Then
ltd2()
EndIf
If GUICtrlRead($Radio4) = $GUI_CHECKED Then
ltd3()
EndIf
EndFunc
Func ltd1()
$ftime = ControlGetText($Tittle,'使用期限',$Date1)
$D1 = ControlGetText($Tittle,'使用期限',$Input3)
$D2 = ControlGetText($Tittle,'使用期限',$Input2)
$D3 = $D1 * 366
$11 = _DateDiff('D', $Time, $ftime)
If $11 > 366 Then
MsgBox(0+16,'错误','请填入正确的有效数值!')
GUISetState(@SW_HIDE,$Form1)
ElseIf $11 < 1 Then
MsgBox(0+16,'错误','请填入正确的有效数值!')
Else
IniWriteSection('c:\myfile.ini','FTIME','ftime=' & $Time);写入
IniWriteSection('c:\myfile.ini','DATE','date=' & $ftime);写入
IniWriteSection('c:\myfile.ini','TIME','time=');写入
EndIf
EndFunc
Func ltd2()
$ftime = ControlGetText($Tittle,'使用期限',$Date1)
$D1 = ControlGetText($Tittle,'使用期限',$Input3)
$D2 = ControlGetText($Tittle,'使用期限',$Input2)
$D3 = $D1 * 366
If $D1 > 2 Then
MsgBox(0+16,'错误','请填入正确的有效数值!')
ElseIf $D1 < 1 Then
MsgBox(0+16,'错误','请填入正确的有效数值!')
Else
IniWriteSection('c:\myfile.ini','FTIME','ftime=' & $Time);写入
IniWriteSection('c:\myfile.ini','TIME','time=' & $D3);写入
IniWriteSection('c:\myfile.ini','DATE','date=');写入
EndIf
EndFunc
Func ltd3()
$ftime = ControlGetText($Tittle,'使用期限',$Date1)
$D1 = ControlGetText($Tittle,'使用期限',$Input3)
$D2 = ControlGetText($Tittle,'使用期限',$Input2)
$D3 = $D1 * 366
If $D2 > 366 Then
MsgBox(0+16,'错误','请填入正确的有效数值!')
ElseIf $D2 < 1 Then
MsgBox(0+16,'错误','请填入正确的有效数值!')
Else
IniWriteSection('c:\myfile.ini','FTIME','ftime=' & $Time);写入
IniWriteSection('c:\myfile.ini','TIME','time=' & $D2);写入
IniWriteSection('c:\myfile.ini','DATE','date=');写入
EndIf
EndFunc