diff options
author | Ian C <ianc@noddybox.co.uk> | 2005-03-29 01:22:42 +0000 |
---|---|---|
committer | Ian C <ianc@noddybox.co.uk> | 2005-03-29 01:22:42 +0000 |
commit | effc648f262bd3bd7b57d4e76db2f768510be55c (patch) | |
tree | d77a2e04e58847a3517649ffa83f86b066de08f6 /src/window.cpp | |
parent | 82f1d860690dc0a2d0210db12344f7ea5e88b6a4 (diff) |
Tweaks to Text controls and text handling.
Diffstat (limited to 'src/window.cpp')
-rw-r--r-- | src/window.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
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<LPARAM>(buff)); + SendMsg(WM_GETTEXT,len+1,reinterpret_cast<LPARAM>(buff)); res=buff; delete[] buff; |