⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 logi.cpp

📁 用ICE+MFC开发的一个示例程序.以向用户演示ICE的初步应用.
💻 CPP
字号:
// **********************************************************************//// Copyright (c) 2003-2007 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.//// **********************************************************************#include <IceUtil/DisableWarnings.h>#include <stdafx.h>#include <LogI.h>using namespace std;LogI::LogI() :    _hwnd(0){}voidLogI::print(const string& msg){    string s = msg;    string::size_type idx = 0;    while((idx = s.find("\n", idx)) != string::npos)    {        s.replace(idx, 1, "\r\n  ");        idx += 3;    }    message(s);}voidLogI::trace(const string& category, const string& msg){    string s = "[ " + category + ": " + msg + " ]";    string::size_type idx = 0;    while((idx = s.find("\n", idx)) != string::npos)    {        s.replace(idx, 1, "\r\n  ");        idx += 3;    }    message(s);}voidLogI::warning(const string& msg){    message("warning: " + msg);}voidLogI::error(const string& msg){    message("error: " + msg);}voidLogI::message(const string& msg){    string line = msg + "\r\n";    if(_hwnd)    {        post(line);    }    else    {        _buffer.append(line);    }}voidLogI::setHandle(HWND hwnd){    _hwnd = hwnd;    if(_hwnd != 0 && !_buffer.empty())    {        post(_buffer);        _buffer.clear();    }}voidLogI::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);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -