How to get/set text of a textbox in VC++ ?

I have created a textbox in VC++ using following code. ..

HWND ehnd = CreateWindow(TEXT("edit"), TEXT("Enter your text here"),
WS_VISIBLE |WS_CHILD,
50,50,480,300,
hwnd, (HMENU) 3,NULL,NULL);


now I want to get/set the text in the textbox.... please help me out of this...


Thanks in advance,,
Last edited on
GetWindowText and SetWindowText functions
Get the text:

1
2
3
4
5
6
7
8
9
10
//Get window text into a std::string.
std::string GetWindowText (HWND hWnd)
{
	int iLength = (GetWindowTextLength (hWnd) + 1);
	char *cpText = new char [iLength];
	::GetWindowText (hWnd, cpText, iLength);
	string sReturnString = cpText;
	delete [] cpText;
	return sReturnString;
}


Set the text:

http://msdn.microsoft.com/en-us/library/ms633546%28v=vs.85%29.aspx
thanks . . .. .
Topic archived. No new replies allowed.