• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 145
  • Last Modified:

Best way to run a batch prog....

I would like to verify the best way to write a batch program....
If creating a batch program, and I place all the code in the main form, (with no CreateForm commands) then I cannot use any of the VCL components unless I dynamically create them, right?  Is there a better way to do this or am I planning this the best way?
In other words, I can't drop any components (lets say label, listbox, and timer) on a form because even making the form invisible still creates it initially and shows it.  I need to create these dynamically in the main file, after removing any CreateForm statements, correct?

  • 3
  • 2
  • 2
1 Solution
what you are saying is correct just place your code in the main dpr file (view - units - project1) and remove all references to the unit1 and form1 from project.
you may need to add some units to the uses section of the main dpr if your using showmessage() for instance you'd ned to add dialogs etc..
what is your batch program for?
Regards Barry
You could use the command


filename = your file
paramet = parameters behind your filename
sw_show : displays the dosbox, swhide executes the batch-file without showing the dos-window.


You also have to put the link to the directory where fmxutils are in Tools->Environment options :

c:\program files\borland\delphi5\demos\doc\filmanex

jexd99Author Commented:


    There is no way to add/drop components from the VCL in this case is there (when using only the main dpr)?  I think the only option is to dynamically create these as needed, but I just want to make sure before I get too deep into this. :)

(Also how to I give you the points for this when you weren't the first answer?)

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

If you want to give Inthe the points, you could reject my answer :-)
yes you have it all straight in your head :-)
you can only create them dynamically (and only components that dont need a form(canvas property etc) if your not going to have a form ;-)so you couldnt create a tlabel but you could create a
ttimer or use a stringlist but not a memo etc.. you know what i mean .
if you dont know the easist way to remove the default form from a new project you can go to the menu in delphi and choose project - remove from project and choose unit1,form1 then after removeing go to menu item view and choose unts and choose project1.that should set it up to start.

you probably know but you must remember to free these thing you create as well .
i was asking about waht the batch was going to do because i wondered if you knew you could create .bat files in code if you needed.

oh and theres an option on this page   to reject / accept answers .. sorry batalf :-)
jexd99Author Commented:

Thanks for the answer, thats what I thought but I wanted to be sure before I got to deep into it.  I've done these things before then found out later that I could have done things much easier! :-)

Thanks for your answer too batalf, I need to do this in delphi so I can't use a dos bat file, I think we just misunderstood each other on the question. :)

(Inthe, go ahead and answer this question so I can give you the points)
ok cheers,
if you have any troubles you know where to come :-)
well do our best to help further.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

  • 3
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now