-2
我目前正在用WinAPI
與一個用戶界面做一個Win32 DLL項目。 我很困惑我如何在C++中獲取文本框的文本。這是我的一些代碼的樣子。如何獲得Windows文本winapi C++?
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;
這就是我的情況執行功能。
這是我的WinApi按鈕執行。
HWND ExecuteButton = CreateWindow(L"BUTTON", L"EXE", (WS_CHILD | WS_VISIBLE),
340, 380, 60, 20, Pointers::Window, (HMENU)Execute, DllModule, NULL);
我需要幫助,因爲每當我嘗試和類型的東西它去,我把在,如果他們在一些錯誤類型通知用戶的消息。
任意整數數量是否確實需要兩個'文本「和」TextBuffer「?你似乎在使用'TextBuffer',但它會包含垃圾。 – isanae