Aug 7, 2022 at 7:34pm UTC
He, folks
I have a control object. ( CreateWindow )
but can get the string in the TEXT edit window. ( LIB_MEMO )
to add later on whit a DB or local LIB. from the arc, object finder.
void AddControls(HWND hWnd)
{
string LIB_MEMO = "demo";
HWND hWndEdit = CreateWindow(TEXT("Edit"),TEXT(""), WS_VISIBLE | WS_CHILD | WS_BORDER | ES_AUTOHSCROLL | ES_AUTOVSCROLL | ES_MULTILINE | ES_WANTRETURN, 5, 20, 600, 500, hWnd, NULL, NULL, NULL);
SendMessage(hWndEdit, WM_SETTEXT, 0, (LPARAM)LIB_MEMO );
}
but get a conversion conflict whit LIB_MEMO
the second ting i tried is
SetWindowTextA(hWndEdit,"My Application")
Last edited on Aug 8, 2022 at 12:38am UTC
Aug 8, 2022 at 1:49am UTC
It is undefined behavior (if it even compiles) to rely on a std::string being implicitly convertible into an LPARAM.
Search the web for "how to pass string as LPARAM".
Try passing LIB_MEMO.c_str() instead of just LIB_MEMO. (Not tested)
Aug 9, 2022 at 6:23pm UTC
He, Genade tnx for the help.
string totalString;
totalString = "Magent";
SetWindowTextA(hWndEdit,LPCSTR(totalString.c_str()));
Last edited on Aug 9, 2022 at 6:24pm UTC