Beruflich Dokumente
Kultur Dokumente
Introduction
Intended Audience
http://kewlshare.com/dl/e57da67cefee/Delphi7_Personal.zip.html
Or, you may have to locate the Windows installation file manually
and double-click on it. If you go this route, you‘ll need to look in the
/install/ subdirectory once you‘ve extracted the zip archive. Be sure to
maintain the folder paths when extracting:
Installing Delphi 7 Personal Edition
Once you’ve followed the steps I’ve outlined above, the Windows
installer should load:
And now it’s time for us to write our very first program in Delphi.
We will create a console mode application. A console application uses
a text only window for input and output. Generally, console apps
require little in the way of user input. Let’s create such an application
now.
You are now left with a very small program which looks much like
a Turbo Pascal program which, if you compile it will produce a very
small EXE. Note that a Delphi console program is not a DOS program
because it is able to call Windows API functions and also use its own
resources.
This is nothing more than a "standard" Delphi project file, the one
with the .dpr extension. The program keyword identifies this unit as a
program's main source unit. When we run a project file from the IDE,
Delphi uses the name of the Project file for the name of the EXE file
that it creates - Delphi gives the project a default name until you save
the project with a more meaningful name.
The $APPTYPE directive controls whether to generate a Win32
console or graphical UI application. The {$APPTYPE CONSOLE}
directive tells the compiler to generate a console application.
The uses keyword, as usual, lists all the units this unit uses (units
that are part of a project). As you can see, the SysUtils unit is included
by default. Another unit is included too, the System unit, though this is
hidden from us.
In between the begin ... end pair you’ll add your code that will
make the program do something useful (or at least interesting).
Your First Delphi Program
If you go ahead and build the program (Project … Build Project on the
menu), and then navigate to the project’s subdirectory within your
Delphi installation directory, you’ll see that the executable produced is
quite small -- only around 39 Kb, as opposed to over 300 Kb for even
the simplest GUI application (a program that presents a graphical user
interface, such as the ubiquitous Windows form) in Delphi .
Now re-compile and run the program again. This time the console
window appears and stays until you press the Enter key.
You can enter text into the window by typing at your keyboard.
Try it by entering your name. To cause the program to exit, and the
console window to disappear, press the Enter key. Notice that by
default the console program display, in its title bar, the full path to the
executable.
Your First Delphi Program
Another reason that I had you save the project under this name is
so that we can use it as a template, a starting point for future console
applications that we will write. It will save us the work that we had to
do initially to turn a GUI app into a console mode application.