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

Method ControlGetWindowText

source/script_gui.cpp:2068–2083  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2066
2067
2068ResultType GuiType::ControlGetWindowText(ResultToken &aResultToken, GuiControlType &aControl)
2069{
2070 // Set up the result token.
2071 int length = GetWindowTextLength(aControl.hwnd); // Might be zero, which is properly handled below.
2072 if (TokenSetResult(aResultToken, NULL, length) != OK)
2073 return FAIL; // It already displayed the error.
2074 aResultToken.marker_length = GetWindowText(aControl.hwnd, aResultToken.marker, length+1);
2075 // MSDN: "If the function succeeds, the return value is the length, in characters,
2076 // of the copied string, not including the terminating null character."
2077 // However, GetWindowText() works by sending the control a WM_GETTEXT message, and some
2078 // controls don't respond correctly. Link controls have been caught including the null
2079 // terminator in the count, so this works around it:
2080 if (aResultToken.marker_length && !aResultToken.marker[aResultToken.marker_length-1])
2081 --aResultToken.marker_length;
2082 return OK;
2083}
2084
2085
2086void GuiType::ControlRedraw(GuiControlType &aControl, bool aOnlyWithinTab)

Callers

nothing calls this directly

Calls 1

TokenSetResultFunction · 0.85

Tested by

no test coverage detected