Create application without forms

Posted in Application

Delete all forms from your project by using Project Manager and write your code in a project source file (DPR-file). This example creates a file with name like specified parameter and $$$.txt file if parameter is missed.

program Project1;

uses windows;

var
  Str, Str1: string;
  F: TextFile;
begin
  Str:=ParamStr(1);
  if Str<>'' then
  begin
    Str1:=Str;
    Delete(Str,Pos('.',Str),4);
    AssignFile(F,Str+'.txt');
    Rewrite(F);
    Write(F,Str1);
    CloseFile(F);
  end
  else
  begin
    AssignFile(F,'$$$.txt');
    Rewrite(F);
    Write(F,'No parameter');
    CloseFile(F);
  end;
end.