CreateWindow(TEXT("Edit") get string input

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
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)
He, Genade tnx for the help.

string totalString;
totalString = "Magent";

SetWindowTextA(hWndEdit,LPCSTR(totalString.c_str()));




Last edited on
Topic archived. No new replies allowed.