Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Pascal
Expertise: Beginner
Mar 19, 1997

How can I create a Delphi program without VCL components?

Question:
How can I create a Delphi program without VCL components?

Answer:

This code is pretty useless, but is meant to demonstrate that you do not need to use the VCL to create Windows programs. This really shows Delphi'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 need to go into it; however, the project file is where the application executes and 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 from the menu, and the project file will be opened in the editor. It's that easy!

Hopefully, this will give you ideas of what you can do. Here's a hint: Using just a project file, you can create totally form-less applications that can run completely in the background.

All you have to do is open this project file 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        : SaveIt 

 Reference    : Look under help under TSaveDialog to change any of the

parameters

 ===========================================================================

=====}



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.



DevX Pro
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date