Q: how do I get a windows text winapi c++? I am currently making a Win32 DLL project with WinAPI, with a User Interface.
I am confused on how I get a textbox's text in C++. Here is what a bit of my code looks like.
case Execute:
    char text[256];
    TCHAR TextBuffer[_MAX_PATH];
    LRESULT result = SendMessage(Pointers::ExecuteBar, WM_GETTEXT, 256, LPARAM(text));
    HandleCommands(std::string(text));
    std::string UserInput = (std::string)(char*)TextBuffer;
    if (Enabled)
    {
        HandleCommands(UserInput);
    }
    else
    {
        PushMessage(L"Not Initialized.", RGB(255, 140, 0));
    };
    break;
};
break;

that's my case Execute function.
Here's my WinApi Button for Execute.
HWND ExecuteButton = CreateWindow(L"BUTTON", L"EXE", (WS_CHILD | WS_VISIBLE),
    340, 380, 60, 20, Pointers::Window, (HMENU)Execute, DllModule, NULL);

I need help because whenever I try and type in something it goes to a message that I put in to notify the user if they typed in something wrong.

A: If you want to get the text of a window just use the GetWindowText() function


*

*1st param is the handle to the window you want to copy its text.

*2nd param is the char that must be previously defined .

*3rd param is the max number of chars you will copy.


Example:
char copy[ ] = " ";
GetWindowText(hWndTextBox, &copy[0], sizeof(copy)-1);

Here the 3rd param will give it an unlimited numbers of chars to get copied you can set it to any integer number like 20
