#include <stdio.h>
#include <Windows.h>
#define APP_MGR singleton::getInstance()

class appMgr
{
 friend class singleton;
private:
 appMgr(void) : m_hWnd(NULL), m_hInst( NULL )
 {
  m_hWnd = GetConsoleWindow();
  m_hInst = GetModuleHandle(NULL);
 }
 ~appMgr(void)      {      }
public:
 inline HWND gethWnd(void)   { return m_hWnd;  }
 inline HINSTANCE getInstance(void) { return m_hInst; }
 void render( HDC hdc );
 void update( void );
 int apploop( void );
private:
 HWND     m_hWnd;
 HINSTANCE    m_hInst;
};

class singleton
{
 singleton();
 ~singleton();
public:
 static appMgr* getInstance(void)
 {
  static appMgr instance;
  return &instance;
 }
};

void appMgr::render(HDC hdc)
{
 HBITMAP hbit, oldbit;
 BITMAP info;
 HDC  memDC;
 memDC = CreateCompatibleDC(hdc);
 hbit = (HBITMAP)LoadImage(m_hInst, TEXT("D:/Project/콘솔/테스트.bmp"), IMAGE_BITMAP, NULL, NULL, LR_LOADFROMFILE );
 oldbit = (HBITMAP)SelectObject( memDC, (HBITMAP)hbit );
 GetObject(hbit, sizeof(BITMAP), &info);
 BitBlt(hdc, 0, 0, info.bmWidth, info.bmHeight, memDC, 0, 0, SRCCOPY );
 DeleteObject(SelectObject(memDC, oldbit));
 DeleteDC(memDC);
}

void appMgr::update(void)
{
}

int appMgr::apploop(void)
{
 while (true)
 {
  update();
  HDC hdc = GetDC(m_hWnd);
  render(hdc );
  ReleaseDC(m_hWnd, hdc);
 }
 return 0;
}

int main(void)
{
 return APP_MGR->apploop();
}


결과