Function Reference


_GUICtrlMonthCal_SetSelRange

Sets the selection for a month calendar control to a given date range

#include <GuiMonthCal.au3>
_GUICtrlMonthCal_SetSelRange ( $hWnd, $iMinYear, $iMinMonth, $iMinDay, $iMaxYear, $iMaxMonth, $iMaxDay )

Parameters

$hWnd Control ID/Handle to the control
$iMinYear Minimum year
$iMinMonth Minimum month
$iMinDay Minimum day
$iMaxYear Maximum year
$iMaxMonth Maximum month
$iMaxDay Maximum day

Return Value

Success: True.
Failure: False.

Remarks

This message will fail if applied to a month calendar control that does not use the $MCS_MULTISELECT style.

Related

_GUICtrlMonthCal_GetSelRange

Example

#include <GUIConstantsEx.au3>
#include <GuiMonthCal.au3>
#include <WindowsConstants.au3>

Global $g_idMemo

Example()

Func Example()
    Local $tRange, $idMonthCal

    ; Create GUI
    GUICreate("Month Calendar Set Sel Range", 400, 300)
    $idMonthCal = GUICtrlCreateMonthCal("", 4, 4, -1, -1, BitOR($WS_BORDER, $MCS_MULTISELECT), 0x00000000)

    ; Create memo control
    $g_idMemo = GUICtrlCreateEdit("", 4, 168, 392, 128, 0)
    GUICtrlSetFont($g_idMemo, 9, 400, 0, "Courier New")
    GUISetState(@SW_SHOW)

    ; Get/Set selection
    _GUICtrlMonthCal_SetSelRange($idMonthCal, @YEAR, @MON, 1, @YEAR, @MON, 7)
    $tRange = _GUICtrlMonthCal_GetSelRange($idMonthCal)
    MemoWrite("Start date: " & StringFormat("%02d/%02d/%04d", DllStructGetData($tRange, "MinMonth"), _
            DllStructGetData($tRange, "MinDay"), _
            DllStructGetData($tRange, "MinYear")))
    MemoWrite("End date .: " & StringFormat("%02d/%02d/%04d", DllStructGetData($tRange, "MaxMonth"), _
            DllStructGetData($tRange, "MaxDay"), _
            DllStructGetData($tRange, "MaxYear")))

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

; Write message to memo
Func MemoWrite($sMessage)
    GUICtrlSetData($g_idMemo, $sMessage & @CRLF, 1)
EndFunc   ;==>MemoWrite