|
/********************************************************************\
created: 2001/03/22
created: 22:3:2001 20:21
filename: c:\my projects\dualmagic\controlappl\include\cwinlog.h
file path: c:\my projects\dualmagic\controlappl\include
file base: cwinlog
file ext: h
author: Alex Kucherenko
purpose:
\********************************************************************/
#ifndef _LOG_SYSTEM_WIN_LOG_H_
#define _LOG_SYSTEM_WIN_LOG_H_
#include <string>
#include <vector>
#include "CStoreLog.h"
typedef std::string string;
typedef std::vector<string> TStrArray;
typedef TStrArray::iterator TStrIter;
#define WINDOW_HEIGHT 400
#define WINDOW_LENGTH 600
#define WM_USERSENDMESSAGE WM_USER+1
//////////////////////////////////////////////////////////////////////////
//
class CLogSimpleLock
{
public:
CLogSimpleLock( CRITICAL_SECTION *pSection ) : m_pSection( pSection )
{
if( m_pSection != NULL )
EnterCriticalSection( m_pSection );
}
~CLogSimpleLock( )
{
if( m_pSection != NULL )
LeaveCriticalSection( m_pSection );
}
private:
CRITICAL_SECTION *m_pSection;
};
//////////////////////////////////////////////////////////////////////////
//
class CWinLog : public CStoreLog
{
public:
CWinLog( long MaxLines = 1000 );
virtual ~CWinLog( );
virtual int FlushData();
virtual int WriteString( std::string &Message );
virtual int SetBufferLimit( long lSize );
protected:
HWND CreateLogWindow( void );
static LRESULT APIENTRY localWndProc( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam );
private:
ULONG m_lMaxLines;
TStrArray m_CurrMessage;
long m_lBufferLimit;
HWND m_hEdit;
HWND m_hWindow;
CRITICAL_SECTION m_CriticalSection;
};
#endif /* _LOG_SYSTEM_WIN_LOG_H_ */
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.