Console Application


How can I use a visual component in a console application?
If not possible, can I use a form then hide it? Or any other trick?

Thank you,
Luis Martins
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

>can I use a visual component in a console
It depends on which components do you want to use.

>can I use a form then hide it?
Yes, you can.
you can't drop it on a form but you can cerate it like

//Tdatabase here just as sample, the unit of the vcl you need, you must include into the uses-clause
   myDB := TDatabase.Create(Application);
   with myDB do
      //some property adjaustments

btw. control-vcls are a bit usesless in a console-app,
and of course you can also code a hidden win-app using a form
(key would here to add the line
application.showmainform := false;
in the project-source)

meikl ;-)

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ferruccio AccalaiSenior developer, analyst and customer assistance Commented:
well you can also create vcl cmp's as nil...

as i remember shold be:

program Project1;


  SysUtils, StdCtrls;
b: TButton;
  b := Tbutton.Create(nil);
  b.Name := 'Button';
  b.Caption := 'This is a nil button';

F68 ;-)
>well you can also create vcl cmp's as nil...
oh yes, f68, it is a must i guess (because application is per default not available)
hello lfgmartins, you can't do "Visual" controls on a console, maybe if you give more information about what "Visual" control or effect you are trying to do, we could help you more,, ,  or consider swithing to a GUI application
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.