Hello World - worked example
key : purple - original code / blue - new code
Step 1 :
Create a new project called Hello using the MFC AppWizard(exe). Select Single Document Application at Step 1 of the Wizard.
Step 2 :
Insert the following code within the OnDraw() function in the View :
void
CHelloView::OnDraw(CDC* pDC)
{
CHelloDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
pDC->TextOut(0, 0, "Hello World!");
}
nb : the code in blue is the only change that should be made.
Click here for the basic exercise
Click here for the source code
Click here to return to menu