Click here to Skip to main content
15,885,546 members
Articles / Programming Languages / Objective C

Running State Machine Based Win32/WinCE Programs

Rate me:
Please Sign up or sign in to vote.
4.37/5 (9 votes)
17 May 20065 min read 70.7K   1.3K   35  
This article describes how to run state machine application framework based Win32/WinCE programs using the window message hooking technology. (Open source project)
// CDispCtrl.cpp : implementation file
//

#include "stdafx.h"
#include "simulator.h"
#include "DispCtrl.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CDispCtrl

CDispCtrl::CDispCtrl()
{
	m_DispBuf = new COLORREF[DISP_WIDTH*DISP_HEIGHT];
	for (int x=0; x< DISP_WIDTH; x++)
		for (int y=0; y< DISP_HEIGHT; y++)
			m_DispBuf[x+y*DISP_WIDTH] = 0;
}

CDispCtrl::~CDispCtrl()
{
	delete m_DispBuf;
}


BEGIN_MESSAGE_MAP(CDispCtrl, CStatic)
	//{{AFX_MSG_MAP(CDispCtrl)
	ON_WM_PAINT()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CDispCtrl message handlers

void CDispCtrl::OnPaint() 
{
	CPaintDC dc(this); // device context for painting
	
	// TODO: Add your message handler code here

	CDC *pDC = GetDC();
	for (int x=0; x<96; x++)
		for (int y=0; y<64; y++)
		{
			pDC->SetPixel(x,y, m_DispBuf[x+y*DISP_WIDTH]);
		}
	
	// Do not call CStatic::OnPaint() for painting messages
}

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.


Written By
Web Developer
China China
Jerome. (Free to speak, free to use.)

Comments and Discussions