RAD Studio
ContentsIndex
PreviousUpNext
Building a Windows "Hello World" Console Application

This "Hello World" console application demonstrates the essential steps for creating a Windows application in Delphi or C++. The application uses Windows, a console window, an event, and will display a dialog in response to a user action.

To create the "Hello world" console application

  1. Create a Windows console application.
  2. Create the logic.
  3. Run the application.

To create a Windows console application

  1. Choose FileNewOther.... The New Items dialog box appears.
  2. In the New Items dialog box, select either Delphi Projects or C++Builder Projects and then double-click Console Application.
  3. For C++, in the New Console Application dialog box, make sure that VCL Forms and Multi-threaded are unchecked, and Console application is checked. Then click OK.

To associate code with the console window

  1. In the code template that is displayed in the Code Editor: For Delphi, enter the following statements after the try keyword and before the except keyword:

WriteLn('Hello, World!');

  ReadLn;

For C++, enter the following after #pragma hdrstop:

#include <iostream>

  1. For C++, enter the following code after the opening brace ({):

std::cout<<”Hello, World!”<<std::endl;
std::cin.ignore();

  1. Save the application.

To run the "Hello World" application

  1. Choose RunRun. The application compiles and displays a console window with your "Hello World" message.
  2. Press the ENTER key. The console window closes when the program terminates.

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!