UDF > GUI > GuiMonthCal >


_GUICtrlMonthCal_Create

Cr�e un contr�le Month Calendar (Calendrier Mensuel)

#include <GuiMonthCal.au3>
_GUICtrlMonthCal_Create ( $hWnd, $iX, $iY [, $iStyle = 0x00000000 [, $iExStyle = 0x00000000]] )

Param�tres

$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.

Valeur de retour

Succ�s: Retourne le handle de la fen�tre du calendrier mensuel.
�chec: Retourne 0.

Remarque

Cette fonction est destin�e aux utilisateurs avertis et pour ceux qui veulent comprendre le fonctionnement du contr�le.

En relation

_GUICtrlMonthCal_Destroy, _GUICtrlMonthCal_GetColorArray

Exemple

#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