49 lines
959 B
C++
49 lines
959 B
C++
|
|
#include "stdafx.h"
|
|
#include "ConsoleScreen.h"
|
|
|
|
CConsoleScreen::CConsoleScreen()
|
|
{
|
|
m_hConsole = NULL;
|
|
|
|
#ifndef NDEBUG
|
|
AllocConsole(); // 콘솔할당
|
|
|
|
m_hConsole = CreateConsoleScreenBuffer(GENERIC_WRITE, FILE_SHARE_WRITE, NULL, CONSOLE_TEXTMODE_BUFFER, NULL);
|
|
|
|
SetConsoleActiveScreenBuffer(m_hConsole);
|
|
COORD cod;
|
|
cod.X = 80;
|
|
cod.Y = 200;
|
|
SetConsoleScreenBufferSize(m_hConsole,cod);
|
|
|
|
char cTitle[256];
|
|
GetConsoleTitle( cTitle, 256 );
|
|
HWND hWndConsole = FindWindow( "ConsoleWindowClass", cTitle);
|
|
MoveWindow( hWndConsole, 0,0, 800, 600, TRUE );
|
|
#endif
|
|
}
|
|
|
|
CConsoleScreen::~CConsoleScreen()
|
|
{
|
|
CloseHandle(m_hConsole);
|
|
}
|
|
|
|
CConsoleScreen& CConsoleScreen::GetInstance()
|
|
{
|
|
static CConsoleScreen ConsoleScreen;
|
|
return ConsoleScreen;
|
|
}
|
|
|
|
//스크린에 출력
|
|
void CConsoleScreen::ScreenOut( const char* pBuf )
|
|
{
|
|
#ifndef NDEBUG
|
|
DWORD n = 0;
|
|
int iLength = (int)strlen( pBuf );
|
|
WriteConsole(m_hConsole, pBuf, iLength, &n, NULL);
|
|
#endif
|
|
}
|
|
|
|
|