This documentation is archived and is not being maintained.

HELLO Sample: Demonstrates a Simple Application with a Frame Window

Visual Studio .NET 2003

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 use MFC'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.

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.

Building and Running the Sample

To build and run the HELLO sample

  1. Open the solution hello.sln.
  2. On the Build menu, click Build.
  3. On the Debug menu, click Start Without Debugging.

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


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

Note   Some samples, such as this one, have not been modified to reflect the changes in the Visual C++ wizards, libraries, and compiler, but still demonstrate how to complete your desired task.

See Also

MFC Samples