Export (0) Print
Expand All
Expand Minimize

HELLOAPP Sample: Demonstrates Minimal Hello World Application

Visual Studio .NET 2003

The HELLOAPP sample is the minimal MFC sample and illustrates how few lines of code are required to get a window to appear on the screen.

HELLOAPP is even simpler than the HELLO sample; HELLOAPP does not paint anything in the main window's client area, nor does it even have a message map for the main window. HELLOAPP is nevertheless instructive in that it demonstrates the minimal overhead required for a content-less application, as opposed to, for example, a WinMain-type of application developed using the Platform SDK.

Like any application written using MFC, HELLOAPP 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 class CMainWindow), and then call the window's ShowWindow and UpdateWindow functions.

Building and Running the Sample

To build and run the HELLOAPP sample

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

When you run HELLOAPP, it displays "Hello World!" in the title bar of an empty application window.


This sample demonstrates the following keywords:

CFrameWnd::Create; CFrameWnd::rectDefault; CWinApp::InitInstance; 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

© 2014 Microsoft