summaryrefslogtreecommitdiff
path: root/cpp/demo/Ice/MFC/server/LogI.cpp
diff options
context:
space:
mode:
authorMatthew Newhook <matthew@zeroc.com>2005-08-08 02:45:11 +0000
committerMatthew Newhook <matthew@zeroc.com>2005-08-08 02:45:11 +0000
commit475d10e3bded459e33bcd71d40286ac381571469 (patch)
tree0b6c549b954de6ba122abfc2a11bbd0400a74b42 /cpp/demo/Ice/MFC/server/LogI.cpp
parentclean up MFC demo. Fix bug with the status bar. (diff)
downloadice-475d10e3bded459e33bcd71d40286ac381571469.tar.bz2
ice-475d10e3bded459e33bcd71d40286ac381571469.tar.xz
ice-475d10e3bded459e33bcd71d40286ac381571469.zip
Fixed bug with Log implementation.
Diffstat (limited to 'cpp/demo/Ice/MFC/server/LogI.cpp')
-rw-r--r--cpp/demo/Ice/MFC/server/LogI.cpp32
1 files changed, 20 insertions, 12 deletions
diff --git a/cpp/demo/Ice/MFC/server/LogI.cpp b/cpp/demo/Ice/MFC/server/LogI.cpp
index 705430ac49c..99ec1ce2ee3 100644
--- a/cpp/demo/Ice/MFC/server/LogI.cpp
+++ b/cpp/demo/Ice/MFC/server/LogI.cpp
@@ -2,18 +2,18 @@
//
// Copyright (c) 2003-2005 ZeroC, Inc. All rights reserved.
//
-// This copy of Ice is licensed to you under the terms described in the
-// ICE_LICENSE file included in this distribution.
+// This copy of Ice-E is licensed to you under the terms described in the
+// ICEE_LICENSE file included in this distribution.
//
// **********************************************************************
-#include "stdafx.h"
-#include "LogI.h"
+#include <stdafx.h>
+#include <LogI.h>
using namespace std;
LogI::LogI() :
- _log(0)
+ _hwnd(0)
{
}
@@ -63,10 +63,9 @@ void
LogI::message(const string& msg)
{
string line = msg + "\r\n";
- if(_log)
+ if(_hwnd)
{
- _log->SetSel(-1, -1);
- _log->ReplaceSel(CString(line.c_str()));
+ post(line);
}
else
{
@@ -75,12 +74,21 @@ LogI::message(const string& msg)
}
void
-LogI::setControl(CEdit* log)
+LogI::setHandle(HWND hwnd)
{
- _log = log;
- if(!_buffer.empty())
+ _hwnd = hwnd;
+ if(_hwnd != 0 && !_buffer.empty())
{
- _log->ReplaceSel(CString(_buffer.c_str()));
+ post(_buffer);
_buffer.clear();
}
}
+
+void
+LogI::post(const string& data)
+{
+ assert(_hwnd != 0);
+ char* text = new char[data.size()+1];
+ strcpy(text, data.c_str());
+ ::PostMessage(_hwnd, WM_USER, (WPARAM)FALSE, (LPARAM)text);
+}