From effc648f262bd3bd7b57d4e76db2f768510be55c Mon Sep 17 00:00:00 2001 From: Ian C Date: Tue, 29 Mar 2005 01:22:42 +0000 Subject: Tweaks to Text controls and text handling. --- src/window.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'src/window.cpp') diff --git a/src/window.cpp b/src/window.cpp index 492ecfd..af662b9 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -68,14 +68,23 @@ void Window::SetText(const char *text) // ------------------------------------------------------------ // -std::string Window::GetText(int maxlen) +void Window::SetText(const std::string& text) { - char *buff=new char[maxlen+1]; + SetText(text.c_str()); +} + + +// ------------------------------------------------------------ +// +std::string Window::GetText() +{ + int len=GetWindowTextLength(m_wnd); + char *buff=new char[len+1]; std::string res; buff[0]=0; - SendMsg(WM_GETTEXT,maxlen,reinterpret_cast(buff)); + SendMsg(WM_GETTEXT,len+1,reinterpret_cast(buff)); res=buff; delete[] buff; -- cgit v1.2.3