home *** CD-ROM | disk | FTP | other *** search
- // MainFrm.cpp : implementation of the CMainFrame class
- //
-
- #include "stdafx.h"
- #include "demo.h"
-
- #include "MainFrm.h"
-
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
-
- /////////////////////////////////////////////////////////////////////////////
- // CMainFrame
-
- IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)
-
- BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
- //{{AFX_MSG_MAP(CMainFrame)
- ON_WM_CREATE()
- ON_WM_PAINT()
- ON_COMMAND(ID_MENUITEM_EXIT, OnMenuitemExit)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
-
- /////////////////////////////////////////////////////////////////////////////
- // CMainFrame construction/destruction
-
- CMainFrame::CMainFrame()
- {
- // TODO: add member initialization code here
-
- }
-
- CMainFrame::~CMainFrame()
- {
- }
-
- BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
- {
- // TODO: Modify the Window class or styles here by modifying
- // the CREATESTRUCT cs
-
- return CFrameWnd::PreCreateWindow(cs);
- }
-
- /////////////////////////////////////////////////////////////////////////////
- // CMainFrame diagnostics
-
- #ifdef _DEBUG
- void CMainFrame::AssertValid() const
- {
- CFrameWnd::AssertValid();
- }
-
- void CMainFrame::Dump(CDumpContext& dc) const
- {
- CFrameWnd::Dump(dc);
- }
-
- #endif //_DEBUG
-
- /////////////////////////////////////////////////////////////////////////////
- // CMainFrame message handlers
-
- LRESULT CMainFrame::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
- {
- // TODO: Add your specialized code here and/or call the base class
- if(message == (WM_USER + 1001))
- {
- ProcessMessage(wParam, lParam);
- }
-
- return CFrameWnd::WindowProc(message, wParam, lParam);
- }
-
- void CMainFrame::ProcessMessage(WPARAM wParam, LPARAM lParam)
- {
-
- char* l[] = {"╡τ╗░","┐┤╙░╡·","╠²╥⌠└╓","═µ╙╬╧╖",
- "╔╧═°┴─╠∞","┤≥╫╓","▓╗╓¬╡└╧δ╕╔╩▓├┤","╬╥╧δ╤º╡τ─╘"};
- static count = 0;
- CDC* pdc = GetDC();
-
- CBrush brush, *oldbrush;
- if(count%2) brush.CreateSolidBrush(RGB(192, 192, 192));
- else brush.CreateSolidBrush(RGB(255,255,0));
-
- oldbrush = pdc->SelectObject(&brush);
-
- CString L0("╩╢▒≡╜ß╣√");
- CString L1(l[wParam]);
-
- pdc->Rectangle(100, 150, 400, 300);
-
- CFont font;
- font.CreateFont(18, 8, 5, 5, FW_THIN, 0, 0, 0, ANSI_CHARSET, OUT_CHARACTER_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH, "DuttyFont" );
- CFont * oldFont;
- oldFont = pdc->SelectObject(&font);
-
-
- pdc->TextOut(140, 180, L0);
- pdc->TextOut(200, 220, L1);
-
- pdc->SelectObject(oldFont);
- ReleaseDC(pdc);
- count ++;
-
- }
-
- BOOL CMainFrame::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext)
- {
- // TODO: Add your specialized code here and/or call the base class
-
- return CWnd::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, nID, pContext);
- }
-
- int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
- {
- if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
- return -1;
-
- // TODO: Add your specialized creation code here
- SetWindowText("Demo Window");
- return 0;
- }
-
- void CMainFrame::OnPaint()
- {
- CPaintDC dc(this); // device context for painting
-
-
- SetWindowText("Demo Window");
-
- }
-
- void CMainFrame::OnMenuitemExit()
- {
- DestroyWindow();
- }
-