summaryrefslogtreecommitdiff
path: root/src/window.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/window.cpp')
-rw-r--r--src/window.cpp15
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;