设置指定日期的“今天”日期信息
#Include <GuiMonthCal.au3>
_GUICtrlMonthCal_SetToday($hWnd, $iYear, $iMonth, $iDay)
$hWnd | 控件句柄 |
$iYear | 年 |
$iMonth | 月 |
$iDay | 日 |
#include <GUIConstantsEx.au3>
#include <GuiMonthCal.au3>
#include <WindowsConstants.au3>
$Debug_MC = False ; Check ClassName being passed to MonthCal functions, set to True and use a handle to another control to see it work
Global $iMemo
_Main()
Func _Main()
Local $tToday, $hMonthCal
; 创建 GUI
GUICreate("Month Calendar Set Today", 400, 300)
$hMonthCal = GUICtrlCreateMonthCal("", 4, 4, -1, -1, $WS_BORDER, 0x00000000)
; 创建 memo 控件
$iMemo = GUICtrlCreateEdit("", 4, 168, 392, 128, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()
; Get/Set today
_GUICtrlMonthCal_SetToday($hMonthCal, @YEAR, 8, 19)
$tToday = _GUICtrlMonthCal_GetToday($hMonthCal)
MemoWrite("Today: " & StringFormat("%02d/%02d/%04d", DllStructGetData($tToday, "Month"), _
DllStructGetData($tToday, "Day"), _
DllStructGetData($tToday, "Year")))
; 循环直到用户退出
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main
; 写入消息到 memo
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite