Building a Windows Hello World Console Application
Go Up to How To Build Windows VCL Applications
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
- Create a Windows console application.
- Create the logic.
- Run the application.
To create a Windows console application
- Choose File > New > Other... .The New Items dialog box appears.
- In the New Items dialog box, select either Delphi or C++Builder and then double-click Console Application.
- 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
- 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>
- For C++, enter the following code after the opening brace ({):.
std::cout<<"Hello, World!"<<std::endl;
std::cin.ignore();
- Save the application.
To run the "Hello World" application
- Choose Run > Run .The application compiles and displays a console window with your "Hello World" message.
- Press the ENTER key. The console window closes when the program terminates.