Re: Get text from textbox
Quote:
GetWindowText which needs a char
Code:
int GetWindowText(
__in HWND hWnd,
__out LPTSTR lpString,
__in int nMaxCount
);
I guess I'm not understanding what you wrote as I don't see where the GetWindowText() function needs a char? Might you be having some kind of UNICODE problems?
Re: Get text from textbox
Code:
void GetTextAndDoSomething(HWND hWnd)
{
// get the length of the text
const int nTextLength = ::GetWindowTextLength(hWnd);
// allocate a buffer for the text
char * pData = new char[nTextLength + 1];
// Get the text
::GetWindowTextA(hWnd,pData,nTextLength + 1);
// Do something with this text
::MessageBoxA(0,pData,"This is the text!",MB_OK);
// free the buffer
delete [] pData;
}
Re: Get text from textbox
thanks you two:D you helped me out
thanks again!