HELLO: Demonstrates a Simple Application with a Frame Window

Click to open or copy the HELLO project files.

The HELLO sample is the classic "Hello, World" application. HELLO illustrates a single application window with a menu and About box. The sample does not make use of the framework's document/view architecture. HELLO also illustrates using string resource names rather than numeric IDs. Given that Microsoft Visual C++ makes it easy to use more efficient numeric IDs and symbols, HELLO's approach of using string names is not recommended.

When you run HELLO, it displays "Hello, Windows!" centered in the application window. Use the Help About command, or F1, to see the About box.

Like any application written using MFC, HELLO has a CWinApp-derived class. This application class provides a minimal implementation of InitInstance, which is to construct a frame window object (of the application-specific CMainWindow class), and then call the window's ShowWindow and UpdateWindow functions. HELLO displays "Hello, Windows!" in response to the WM_PAINT message by specifying a message map entry, ON_WM_PAINT, for CMainWindow and by implementing the OnPaint handler.

This sample demonstrates the following keywords:

CDC::SetBkMode; CDC::SetTextAlign; CDC::SetTextColor; CDC::TextOut; CDialog::DoModal; CFrameWnd::LoadFrame; CString::LoadString; CWnd::GetClientRect; CWnd::OnPaint; GetSysColor; ShowWindow; UpdateWindow