AntiPattern

Lambda Captures by Value

lambda-capture-by-value-state

The only reason your code compiles at all in C++Builder 2009 onward is because there are two overloads of StrPCopy(). Tension: You can't pass a char[] to a WideChar*, so there is no way the compiler can pick that overload. Outcome: if you have included both System.AnsiStrings.hpp and System.SysUtils.hpp in the same .cpp. | call to 'StrPCopy' is ambiguous — copying code from an old C++ Builder 2009 application into it. Tension: I would very much like to use it as-is. | Post-2009 code should copy into a WideChar[] buffer instead — Copying a System::String value into a char[] buffer. Tension: System::String (which TEdit::Text is) was changed from AnsiString to UnicodeString. Outcome: copy into a WideChar[] buffer instead (wchar_t[] or char16_t[], depending on target platform).