Crée un contrôle Month Calendar (Calendrier Mensuel)
#include <GuiMonthCal.au3>
_GUICtrlMonthCal_Create ( $hWnd, $iX, $iY [, $iStyle = 0x00000000 [, $iExStyle = 0x00000000]] )
$hWnd | Handle du parent ou de la fenêtre propriétaire |
$iX | Position horizontale du contrôle |
$iY | Position verticale du contrôle |
$iStyle | [optionnel] Styles du contrôle: $MCS_DAYSTATE - Le calendrier mensuel enverra des notifications $MCN_GETDAYSTATE pour demander des informations sur les jours doivent être affichés en gras. $MCS_MULTISELECT - Le calendrier mensuel permettra à l'utilisateur de sélectionner une plage de dates dans le contrôle $MCS_WEEKNUMBERS - Le contrôle calendrier mensuel affiche les numéros de semaine à la gauche de chaque rangée de jours $MCS_NOTODAYCIRCLE - Le contrôle calendrier mensuel n'encerclera pas la date du jour $MCS_NOTODAY - Le contrôle calendrier mensuel n'affichera pas la date du jour en bas Forçé: $WS_CHILD, $WS_VISIBLE |
$iExStyle | [optionnel] Style étendu du contrôle. Ils correspondent aux constantes standards $WS_EX_*. Voir Table des Styles Etendus. |
Succès: | Retourne le handle de la fenêtre du calendrier mensuel. |
Échec: | Retourne 0. |
Cette fonction est destinée aux utilisateurs avertis et pour ceux qui veulent comprendre le fonctionnement du contrôle.
_GUICtrlMonthCal_Destroy, _GUICtrlMonthCal_GetColorArray
#include <GUIConstantsEx.au3> #include <GuiMonthCal.au3> #include <WindowsConstants.au3> Global $g_hMonthCal Example() Func Example() Local $hGUI ; Crée une GUI $hGUI = GUICreate("Month Calendar Create", 400, 300) $g_hMonthCal = _GUICtrlMonthCal_Create($hGUI, 4, 4, $WS_BORDER) GUISetState(@SW_SHOW) GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") ; Boucle jusqu'à ce que l'utilisateur quitte. Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>Example Func WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $tInfo $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") If $hWndFrom = $g_hMonthCal Then Switch $iCode Case $MCN_GETDAYSTATE ; Envoyé par un contrôle calendrier mensuel pour demander des informations sur la façon dont un jour particulier doit être affiché $tInfo = DllStructCreate($tagNMDAYSTATE, $lParam) _DebugPrint("$MCN_GETDAYSTATE" & @CRLF & "--> hWndFrom:" & @TAB & $hWndFrom & @CRLF & _ "-->IDFrom:" & @TAB & $iIDFrom & @CRLF & _ "-->Code:" & @TAB & $iCode & @CRLF & _ "-->Year:" & @TAB & DllStructGetData($tInfo, "Year") & @CRLF & _ "-->Month:" & @TAB & DllStructGetData($tInfo, "Month") & @CRLF & _ "-->DOW:" & @TAB & DllStructGetData($tInfo, "DOW") & @CRLF & _ "-->Day:" & @TAB & DllStructGetData($tInfo, "Day") & @CRLF & _ "-->Hour:" & @TAB & DllStructGetData($tInfo, "Hour") & @CRLF & _ "-->Minute:" & @TAB & DllStructGetData($tInfo, "Minute") & @CRLF & _ "-->Second:" & @TAB & DllStructGetData($tInfo, "Second") & @CRLF & _ "-->MSecond:" & @TAB & DllStructGetData($tInfo, "MSecond") & @CRLF & _ "-->DayState:" & @TAB & DllStructGetData($tInfo, "DayState") & @CRLF & _ "-->pDayState:" & @TAB & DllStructGetData($tInfo, "pDayState")) ; Adresse d'un tableau de MONTHDAYSTATE (champ de bits DWORD qui contient l'état de chaque jour du mois) ; Chaque bit (de 1 à 31) représente l'état d'un jour du mois. Si un bit est à 1, le jour correspondant sera affiché ; en gras; sinon il sera affiché sans emphase. ; Aucune valeur retournée Case $MCN_SELCHANGE ; Envoyé par un contrôle calendrier mensuel quand la élection d'une date ou d'une plage de dates change $tInfo = DllStructCreate($tagNMSELCHANGE, $lParam) _DebugPrint("$MCN_SELCHANGE" & @CRLF & "--> hWndFrom:" & @TAB & $hWndFrom & @CRLF & _ "-->IDFrom:" & @TAB & $iIDFrom & @CRLF & _ "-->Code:" & @TAB & $iCode & @CRLF & _ "-->BegYear:" & @TAB & DllStructGetData($tInfo, "BegYear") & @CRLF & _ "-->BegMonth:" & @TAB & DllStructGetData($tInfo, "BegMonth") & @CRLF & _ "-->BegDOW:" & @TAB & DllStructGetData($tInfo, "BegDOW") & @CRLF & _ "-->BegDay:" & @TAB & DllStructGetData($tInfo, "BegDay") & @CRLF & _ "-->BegHour:" & @TAB & DllStructGetData($tInfo, "BegHour") & @CRLF & _ "-->BegMinute:" & @TAB & DllStructGetData($tInfo, "BegMinute") & @CRLF & _ "-->BegSecond:" & @TAB & DllStructGetData($tInfo, "BegSecond") & @CRLF & _ "-->BegMSeconds:" & @TAB & DllStructGetData($tInfo, "BegMSeconds") & @CRLF & _ "-->EndYear:" & @TAB & DllStructGetData($tInfo, "EndYear") & @CRLF & _ "-->EndMonth:" & @TAB & DllStructGetData($tInfo, "EndMonth") & @CRLF & _ "-->EndDOW:" & @TAB & DllStructGetData($tInfo, "EndDOW") & @CRLF & _ "-->EndDay:" & @TAB & DllStructGetData($tInfo, "EndDay") & @CRLF & _ "-->EndHour:" & @TAB & DllStructGetData($tInfo, "EndHour") & @CRLF & _ "-->EndMinute:" & @TAB & DllStructGetData($tInfo, "EndMinute") & @CRLF & _ "-->EndSecond:" & @TAB & DllStructGetData($tInfo, "EndSecond") & @CRLF & _ "-->EndMSeconds:" & @TAB & DllStructGetData($tInfo, "EndMSeconds")) ; Aucune valeur retournée Case $MCN_SELECT ; Envoyé par un contrôle calendrier mensuel quand l'utilisateur sélectionne une date dans un calendrier mensuel $tInfo = DllStructCreate($tagNMSELCHANGE, $lParam) _DebugPrint("$MCN_SELECT" & @CRLF & "--> hWndFrom:" & @TAB & $hWndFrom & @CRLF & _ "-->IDFrom:" & @TAB & $iIDFrom & @CRLF & _ "-->Code:" & @TAB & $iCode & @CRLF & _ "-->BegYear:" & @TAB & DllStructGetData($tInfo, "BegYear") & @CRLF & _ "-->BegMonth:" & @TAB & DllStructGetData($tInfo, "BegMonth") & @CRLF & _ "-->BegDOW:" & @TAB & DllStructGetData($tInfo, "BegDOW") & @CRLF & _ "-->BegDay:" & @TAB & DllStructGetData($tInfo, "BegDay") & @CRLF & _ "-->BegHour:" & @TAB & DllStructGetData($tInfo, "BegHour") & @CRLF & _ "-->BegMinute:" & @TAB & DllStructGetData($tInfo, "BegMinute") & @CRLF & _ "-->BegSecond:" & @TAB & DllStructGetData($tInfo, "BegSecond") & @CRLF & _ "-->BegMSeconds:" & @TAB & DllStructGetData($tInfo, "BegMSeconds") & @CRLF & _ "-->EndYear:" & @TAB & DllStructGetData($tInfo, "EndYear") & @CRLF & _ "-->EndMonth:" & @TAB & DllStructGetData($tInfo, "EndMonth") & @CRLF & _ "-->EndDOW:" & @TAB & DllStructGetData($tInfo, "EndDOW") & @CRLF & _ "-->EndDay:" & @TAB & DllStructGetData($tInfo, "EndDay") & @CRLF & _ "-->EndHour:" & @TAB & DllStructGetData($tInfo, "EndHour") & @CRLF & _ "-->EndMinute:" & @TAB & DllStructGetData($tInfo, "EndMinute") & @CRLF & _ "-->EndSecond:" & @TAB & DllStructGetData($tInfo, "EndSecond") & @CRLF & _ "-->EndMSeconds:" & @TAB & DllStructGetData($tInfo, "EndMSeconds")) ; Aucune valeur retournée EndSwitch EndIf Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY Func _DebugPrint($s_Text, $sLine = @ScriptLineNumber) ConsoleWrite( _ "!===========================================================" & @CRLF & _ "+======================================================" & @CRLF & _ "-->Line(" & StringFormat("%04d", $sLine) & "):" & @TAB & $s_Text & @CRLF & _ "+======================================================" & @CRLF) EndFunc ;==>_DebugPrint