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

Function EnumChildGetText

source/script2.cpp:3075–3102  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3073
3074
3075BOOL CALLBACK EnumChildGetText(HWND aWnd, LPARAM lParam)
3076{
3077 if (!g->DetectHiddenText && !IsWindowVisible(aWnd))
3078 return TRUE; // This child/control is hidden and user doesn't want it considered, so skip it.
3079 length_and_buf_type &lab = *(length_and_buf_type *)lParam; // For performance and convenience.
3080 int length;
3081 if (lab.buf)
3082 length = GetWindowTextTimeout(aWnd, lab.buf + lab.total_length
3083 , (int)(lab.capacity - lab.total_length)); // Not +1. Verified correct because WM_GETTEXT accepts size of buffer, not its length.
3084 else
3085 length = GetWindowTextTimeout(aWnd);
3086 lab.total_length += length;
3087 if (length)
3088 {
3089 if (lab.buf)
3090 {
3091 if (lab.capacity - lab.total_length > 2) // Must be >2 due to zero terminator.
3092 {
3093 _tcscpy(lab.buf + lab.total_length, _T("\r\n")); // Something to delimit each control's text.
3094 lab.total_length += 2;
3095 }
3096 // else don't increment total_length
3097 }
3098 else
3099 lab.total_length += 2; // Since buf is NULL, accumulate the size that *would* be needed.
3100 }
3101 return TRUE; // Continue enumeration through all the child windows of this parent.
3102}
3103
3104
3105

Callers

nothing calls this directly

Calls 1

GetWindowTextTimeoutFunction · 0.85

Tested by

no test coverage detected