#include once "window9.bi"

Type SYSTEMDATEANDTIME_
	As Short Year_
	As Short Month_
	As Short Weekday_
	As Short Day_
	As Short Hour_
	As Short minute_
	As Short second_
	As Short msec_
End Type
Dim shared As SYSTEMDATEANDTIME_ g_sTimel

Function GetStateCalendar(ByVal gadget As long,ByVal flag As long=5) As Integer Export
	SendMessage(GadgetID(gadget), 4097,0 ,Cast(LPARAM,@g_sTimel))
	If flag=1 Then
		Return g_sTimel.Year_
	ElseIf flag=2 Then
		Return g_sTimel.Month_
	elseIf flag=3 Then
		Return g_sTimel.Weekday_
	elseIf flag=4 Then
		Return g_sTimel.Day_
	elseIf flag=5 Then
		Return Val(g_sTimel.Year_ & g_sTimel.Month_ &  g_sTimel.Day_)
	End If
End Function
