My idea is that I write only two programs:
An Gui-program
and a console program
the console program doesn't do anything on simple start, but the Gui-program knows the parameter s and execute it with theese for the necessary messages.
Jake012345, perhaps another way to think about it is to write one program that has at least two units. The first unit is a console or command line unit. It starts up first and if it finds the various things (such as command line parameters) it needs to know to do its job, it goes and does it. If it does not know what to do, it allows the GUI unit to startup and the user can click buttons and enter information to instruct the program to do its job.
In this model, its easier to have most of the working code in the command line unit or units, it makes sense for the GUI, if its started up, to be able to call them. The way you are thinking, you always have to start up the GUI, the forms must be created etc, before the code in there can be called. Even if we don't need the forms.
Someone here on the forum (sorry, cannot remember who, but thanks!) recently pointed out to me that the lpr file can have things like this in it -
....
Application.Initialize;
if ContinueToGUI then begin
Application.CreateForm(TMainForm, MainForm);
Application.CreateForm(TSett, Sett);
....
The ContinueToGUI() function does things like look at command line options and parameters and either triggers the program's purpose or decides to run the GUI.
Davo