would it be possible to add the possibility to use the key "enter" to confirm the key we enter when launching the .exe ? i asked chatgpt how to and it gave me this :
void InputWindow::AddTextBox(int id, const std::string& text, int x, int y, int width, int height)
{
HWND textBox = CreateWindowEx(0, L"EDIT", L"", WS_CHILD | WS_VISIBLE | WS_BORDER | ES_AUTOHSCROLL, x, y, width, height, m_window, reinterpret_cast<HMENU>(id), m_instance, nullptr);
SendMessage(textBox, WM_SETFONT, reinterpret_cast<WPARAM>(m_textBoxFont), TRUE);
SetWindowText(textBox, make_wstring(text).c_str());
auto const handler = [](HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
auto const ctrl = reinterpret_cast<InputWindow*>(GetWindowLongPtr(hwnd, GWLP_USERDATA));
switch (message)
{
case WM_KEYDOWN:
{
if (wParam == VK_RETURN)
{
// Set focus to the button and simulate a click
SetFocus(GetDlgItem(ctrl->m_window, 1));
SendMessage(GetDlgItem(ctrl->m_window, 1), BM_CLICK, 0, 0);
}
break;
}
}
return CallWindowProc(ctrl->m_oldTextBoxProc, hwnd, message, wParam, lParam);
};
SetWindowLongPtr(textBox, GWLP_USERDATA, (LONG_PTR)this);
m_oldTextBoxProc = reinterpret_cast<WNDPROC>(SetWindowLongPtr(textBox, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(handler)));
m_textBoxes.emplace_back(textBox);
}
would it be possible to add the possibility to use the key "enter" to confirm the key we enter when launching the .exe ? i asked chatgpt how to and it gave me this :