Function Reference


_GUICtrlDTP_GetMonthCal

Retrieves the handle to child month calendar control

#include <GuiDateTimePicker.au3>
_GUICtrlDTP_GetMonthCal ( $hWnd )

Parameters

$hWnd Handle to the control

Return Value

Success: the month calendar handle.
Failure: 0

Remarks

DTP controls create a child month calendar control when the user clicks the drop down arrow ($DTN_DROPDOWN notification).
When the month calendar is no longer needed, it is destroyed (a $DTN_CLOSEUP notification is sent on destruction).
So your application must not rely on a static handle to the DTP control's child month calendar.

Example

#include <GUIConstantsEx.au3>
#include <GuiDateTimePicker.au3>

Global $g_idMemo

Example()

Func Example()
        Local $hGui, $hDTP

        ; Create GUI
        $hGui = GUICreate("DateTimePick Get Month Calendar Child Handle", 400, 300)
        $hDTP = _GUICtrlDTP_Create($hGui, 2, 6, 190)
        $g_idMemo = GUICtrlCreateEdit("", 2, 32, 396, 266, 0)
        GUICtrlSetFont($g_idMemo, 9, 400, 0, "Courier New")
        GUISetState(@SW_SHOW)

        ; Set the display format
        _GUICtrlDTP_SetFormat($hDTP, "ddd MMM dd, yyyy hh:mm ttt")

        ; Get month control child handle
        GUICtrlSetData($g_idMemo, "MonthCal child Handle: " & "0x" & Hex(_GUICtrlDTP_GetMonthCal($hDTP)), 1)
        GUICtrlSetData($g_idMemo, " IsPtr=" & IsPtr(_GUICtrlDTP_GetMonthCal($hDTP)), 1)
        GUICtrlSetData($g_idMemo, " IsHWnd=" & IsHWnd(_GUICtrlDTP_GetMonthCal($hDTP)) & @CRLF, 1)

        ; Loop until the user exits.
        Do
        Until GUIGetMsg() = $GUI_EVENT_CLOSE
        GUIDelete()
EndFunc   ;==>Example