Board index » delphi » console apps?

console apps?

Hi guys,

I've written a console app which can be run from the command line, or
just put into the startup folder.

Is there anyway of stopping it opening up a console window if it's run
from the start menu? I know that that's just windows opening up the
environment for it, but is there anyway of hiding this as a black
console screen popping up and then vanishing a few seconds later is
rather annoying.

Dodgy.

 

Re:console apps?


On Mon, 10 Sep 2001 02:46:40 +0100, Dodgy

Quote
<Do...@earth.planet.universe> wrote:
>Hi guys,

>I've written a console app which can be run from the command line, or
>just put into the startup folder.

>Is there anyway of stopping it opening up a console window if it's run
>from the start menu? I know that that's just windows opening up the
>environment for it, but is there anyway of hiding this as a black
>console screen popping up and then vanishing a few seconds later is
>rather annoying.

I don't think so.  You asked for a console app, it needs a console.

If you just want a program that runs invisibly, don't make it a
console app.  Just delete all the forms and the "uses forms" line from
the .dpr file, and you get a program that runs but never creates any
windows.  Delphi complains if the .dpr doesn't use anything, so put in
"uses sysutils" instead of "uses forms".  For example,

program Project2;

uses
  Sysutils;

{$R *.RES}

var
  f : file;
begin
  assign(f,'c:\test.fil');
  rewrite(f);
  close(f);
end.

Duncan Murdoch

Re:console apps?


On Sun, 09 Sep 2001 22:17:05 -0400, Duncan Murdoch <dmurd...@pair.com>
waffled on about something:

Quote
>On Mon, 10 Sep 2001 02:46:40 +0100, Dodgy
><Do...@earth.planet.universe> wrote:

>>Hi guys,

>>I've written a console app which can be run from the command line, or
>>just put into the startup folder.

>>Is there anyway of stopping it opening up a console window if it's run
>>from the start menu? I know that that's just windows opening up the
>>environment for it, but is there anyway of hiding this as a black
>>console screen popping up and then vanishing a few seconds later is
>>rather annoying.

>I don't think so.  You asked for a console app, it needs a console.

>If you just want a program that runs invisibly, don't make it a
>console app.  Just delete all the forms and the "uses forms" line from
>the .dpr file, and you get a program that runs but never creates any
>windows.  Delphi complains if the .dpr doesn't use anything, so put in
>"uses sysutils" instead of "uses forms".  For example,

>program Project2;

>uses
>  Sysutils;

>{$R *.RES}

>var
>  f : file;
>begin
>  assign(f,'c:\test.fil');
>  rewrite(f);
>  close(f);
>end.

>Duncan Murdoch

Ta, I'll give that a try.

D0dgy.

Re:console apps?


Quote
In article <i75opts3qnjmet75d2udc6uj9sk0pih...@4ax.com>, Dodgy wrote:
> Hi guys,

> I've written a console app which can be run from the command line, or
> just put into the startup folder.

> Is there anyway of stopping it opening up a console window if it's run
> from the start menu? I know that that's just windows opening up the
> environment for it, but is there anyway of hiding this as a black
> console screen popping up and then vanishing a few seconds later is
> rather annoying.

Try this:

{$apptype GUI}

and then as first statement in mainprog

showwindow(Getactivewindow,0);

Other Threads