MCPcopy Create free account
hub / github.com/AutoHotkey/AutoHotkey / ControlGetMonthCal

Method ControlGetMonthCal

source/script_gui.cpp:1952–1976  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1950
1951
1952ResultType GuiType::ControlGetMonthCal(ResultToken &aResultToken, GuiControlType &aControl)
1953{
1954 LPTSTR buf = aResultToken.buf;
1955 SYSTEMTIME st[2];
1956 if (GetWindowLong(aControl.hwnd, GWL_STYLE) & MCS_MULTISELECT)
1957 {
1958 // For code simplicity and due to the expected rarity of using the MonthCal control, much less
1959 // in its range-select mode, the range is returned with a dash between the min and max rather
1960 // than as an array or anything fancier.
1961 MonthCal_GetSelRange(aControl.hwnd, st);
1962 // Seems easier for script (due to consistency) to always return it in range format, even if
1963 // only one day is selected.
1964 SystemTimeToYYYYMMDD(buf, st[0]);
1965 buf[8] = '-'; // Retain only the first 8 chars to omit the time portion, which is unreliable (not relevant anyway).
1966 SystemTimeToYYYYMMDD(buf + 9, st[1]);
1967 buf[17] = 0; // Limit to 17 chars to omit the time portion of the second timestamp.
1968 }
1969 else
1970 {
1971 MonthCal_GetCurSel(aControl.hwnd, st);
1972 SystemTimeToYYYYMMDD(buf, st[0]);
1973 buf[8] = 0; // Limit to 8 chars to omit the time portion, which is unreliable (not relevant anyway).
1974 }
1975 _o_return_p(buf);
1976}
1977
1978
1979ResultType GuiType::ControlSetHotkey(GuiControlType &aControl, LPTSTR aContents, ResultToken &aResultToken)

Callers

nothing calls this directly

Calls 1

SystemTimeToYYYYMMDDFunction · 0.85

Tested by

no test coverage detected