Question:
How can I create a Delphi program without VCL components?
Answer:
This code is pretty useless, but is meant to demonstrate that youdo not need to use the VCL to create Windows programs. This really showsDelphi’s Object Pascal roots.
So how do you write something like this?Well, it’s all in the project file. For the most part, you’ll rarely needto go into it; however, the project file is where the application executesand where all your forms that are visible at runtime are created. In essence,the DPR file is a Pascal program file that acts as the equivalent to the’main’ section of a C program.
To get into the Project source file, select View | Project Source fromthe menu, and the project file will be opened in the editor. It’s thateasy!
Hopefully, this will give you ideas of what you can do. Here’sa hint: Using just a project file, you can create totally form-lessapplications that can run completely in the background.
All you have to do is open this projectfile from the IDE, then compile and run it.
{================================================================================ Project Name : SaveIt.DPR Program Name : SaveIt.EXE Written by : Brendan V. Delumpa Date Created : November 2, 1995 Description : This is a simple utility that performs a Save As to a different directory. Notice that it's completely independent of a form. Just compile this program and run it. The initial directory will be the directory from where this program is run. Usage : SaveItReference : Look under help under TSaveDialog to change any of theparameters ================================================================================}program Saveit;uses Forms, Dialogs, SysUtils;{$R *.RES}var SaveDlg : TSaveDialog;begin SaveDlg := TSaveDialog.Create(Application); with SaveDlg do begin InitialDir := ExtractFilePath(ParamStr(0)); FileName := ParamStr(1); Title := '[' + ParamStr(1) + ']-Save File As'; Filter := 'Valid Files|*.DBF;*.CSV;*.WKS;*.XLS'; Options := [ofFileMustExist, ofOverwritePrompt, ofPathMustExist]; Execute; Free; end;end.