Board index » delphi » Application Icon showing in the Task Bar (D4)

Application Icon showing in the Task Bar (D4)

I have an application that runs hidden by calling

    ShowWindow(Application.Handle, SW_HIDE);
    Application.ShowMainForm := False

before Application.Run in the .DPR. On startup nothing shows as expected but
when a form shows up I get the application icon in the task bar together
with the form's icon. It also shows when Alt+Tab is used.

This wasn't the case in Delphi2, now I ported to Delphi4 and can't get it to
work.

Any ideas?

Nicolas Frias
------------------------------------------------------
nicolas_fr...@actiontech.com

 

Re:Application Icon showing in the Task Bar (D4)


On Thu, 13 Aug 1998 16:41:22 -0700, "Nicolas Frias"

Quote
<Nicolas_Fr...@actiontech.com> wrote:
>I have an application that runs hidden by calling

>    ShowWindow(Application.Handle, SW_HIDE);
>    Application.ShowMainForm := False

>before Application.Run in the .DPR. On startup nothing shows as expected but
>when a form shows up I get the application icon in the task bar together
>with the form's icon. It also shows when Alt+Tab is used.

>This wasn't the case in Delphi2, now I ported to Delphi4 and can't get it to
>work.

I seriously doubt that the above would have worked in ANY version of
Delphi, but never mind.

An application isn't a window - it displays and manages windows. If
you tell Windoze to display the application as if it were a window,
you're going to run into the kind of trouble you've described. Remove
the ShowWindow instruction and see what happens.

P.S. It really isn't necessary to ask the same question in ten
newsgroups. Some of us read several newsgroups, and find having to
wade through copies of messages we've already read to be a bit of a
pain.

Re:Application Icon showing in the Task Bar (D4)


As far as i know an application is a WINDOW. To show you, should try this
piece of code:

procedure TForm1.Button1Click(Sender: TObject);var  OldStyle: Integer;
begin
  // add border and caption to the app window  OldStyle := GetWindowLong (
    Application.Handle, gwl_Style);
  SetWindowLong (Application.Handle, gwl_Style,
    OldStyle or ws_ThickFrame or ws_Caption);  // set the size of the app
window
  SetWindowPos (Application.Handle,    0, 0, 0, 200, 100,
    swp_NoMove or swp_NoZOrder);
end;

-Daniel-

MauriceV heeft geschreven in bericht
<35d3a4c2.10953...@news.mia.bellsouth.net>...

Quote
>On Thu, 13 Aug 1998 16:41:22 -0700, "Nicolas Frias"
><Nicolas_Fr...@actiontech.com> wrote:

>>I have an application that runs hidden by calling

>>    ShowWindow(Application.Handle, SW_HIDE);
>>    Application.ShowMainForm := False

>>before Application.Run in the .DPR. On startup nothing shows as expected
but
>>when a form shows up I get the application icon in the task bar together
>>with the form's icon. It also shows when Alt+Tab is used.

>>This wasn't the case in Delphi2, now I ported to Delphi4 and can't get it
to
>>work.

>I seriously doubt that the above would have worked in ANY version of
>Delphi, but never mind.

>An application isn't a window - it displays and manages windows. If
>you tell Windoze to display the application as if it were a window,
>you're going to run into the kind of trouble you've described. Remove
>the ShowWindow instruction and see what happens.

>P.S. It really isn't necessary to ask the same question in ten
>newsgroups. Some of us read several newsgroups, and find having to
>wade through copies of messages we've already read to be a bit of a
>pain.

Re:Application Icon showing in the Task Bar (D4)


On Fri, 14 Aug 1998 08:28:16 +0200, "Dani?l Dijkhuizen"

Quote
<d.dijkhui...@Prevalent.nl> wrote:
>As far as i know an application is a WINDOW. To show you, should try this
>piece of code:

Even the documentation indicates that TApplication is technically a
window, so this isn't really news. The point is that it isn't supposed
to be shown as though it were a window - if the programmer does that,
he will end up with two icons in the task bar.

Re:Application Icon showing in the Task Bar (D4)


I've made a component which can optionally hide your APP and forms from the
TaskBar and from the "close dialog" (ctrl+alt+del dialog) box.
Interested?? Write me or fetch it at "Torry's Delphi Pages" -
http://www.torry.ru/

Janus
Denmark

Quote
Nicolas Frias wrote in message <6qvu0i$cs...@ffx2nh2.uu.net>...
>I have an application that runs hidden by calling

>    ShowWindow(Application.Handle, SW_HIDE);
>    Application.ShowMainForm := False

>before Application.Run in the .DPR. On startup nothing shows as expected
but
>when a form shows up I get the application icon in the task bar together
>with the form's icon. It also shows when Alt+Tab is used.

>This wasn't the case in Delphi2, now I ported to Delphi4 and can't get it
to
>work.

>Any ideas?

>Nicolas Frias
>------------------------------------------------------
>nicolas_fr...@actiontech.com

Re:Application Icon showing in the Task Bar (D4)


First appologies for the multiple posting...
Second I forgot to paste the previous line:

    if IsWindow(Application.Handle) then
    ShowWindow(Application.Handle, SW_HIDE);

In any case this was working before. I tried leaving only
Application.ShowMainForm := False without luck.

This is the code in the .DPR:

begin
  Application.Initialize;
  Application.ShowHint := True;
  Application.Title := 'My App';
  Application.CreateForm(TMyMainForm, AppForm);
  Application.CreateForm(TAboutFrm, AboutFrm);
  AppForm.Visible := False;
  Application.ShowMainForm := False;
  :
  Application.Run;
  :
end.

As soon as other forms (created at run time) are shown, the task bar shows
both, the form and the application ('My App') with their corresponding
icons.

Nicolas Frias
------------------------------------------------------
nicolas_fr...@actiontech.com

Re:Application Icon showing in the Task Bar (D4)


On Fri, 14 Aug 1998 16:11:09 -0700, "Nicolas Frias"

Quote
<Nicolas_Fr...@actiontech.com> wrote:
>This is the code in the .DPR:

>begin
>  Application.Initialize;
>  Application.ShowHint := True;
>  Application.Title := 'My App';
>  Application.CreateForm(TMyMainForm, AppForm);
>  Application.CreateForm(TAboutFrm, AboutFrm);
>  AppForm.Visible := False;
>  Application.ShowMainForm := False;
>  :
>  Application.Run;
>  :
>end.

>As soon as other forms (created at run time) are shown, the task bar shows
>both, the form and the application ('My App') with their corresponding
>icons.

Just curious: What is AppForm?

Re:Application Icon showing in the Task Bar (D4)


Try this in your project source.

uses
  Windows;

var
  iExtStyle: integer;

begin
  iExtStyle:= GetWindowLong(Application.Handle, GWL_EXSTYLE);
  SetWindowLong(Application.Handle, GWL_EXSTYLE, iExtStyle or
WS_EX_TOOLWINDOW and not WS_EX_APPWINDOW);
  ...
end.

--
Felix Venniker,
Landmark Software Design Group B.V.,
The Netherlands.

fvenni...@landmarksdg.com

Nicolas Frias <Nicolas_Fr...@actiontech.com> wrote in article
<6qvu0i$cs...@ffx2nh2.uu.net>...
I have an application that runs hidden by calling

    ShowWindow(Application.Handle, SW_HIDE);
    Application.ShowMainForm := False

before Application.Run in the .DPR. On startup nothing shows as expected
but
when a form shows up I get the application icon in the task bar together
with the form's icon. It also shows when Alt+Tab is used.

This wasn't the case in Delphi2, now I ported to Delphi4 and can't get it
to
work.

Any ideas?

Nicolas Frias
------------------------------------------------------
nicolas_fr...@actiontech.com

Re:Application Icon showing in the Task Bar (D4)


Solved thanks to Felix Venniker, Landmark Software Design Group B.V., The
Netherlands
with the following piece of code in the .DPR:

uses
  Windows;

var
  iExtStyle: integer;

begin
  iExtStyle:= GetWindowLong(Application.Handle, GWL_EXSTYLE);
  SetWindowLong(Application.Handle, GWL_EXSTYLE, iExtStyle or
WS_EX_TOOLWINDOW and not WS_EX_APPWINDOW);
  ...
end.

Thanks.
Nicolas Frias
------------------------------------------------------
nicolas_fr...@actiontech.com

----------------------------------------------------------------------------
-------------------------

Quote
MauriceV wrote in message <35d50e1b.103473...@news.mia.bellsouth.net>...

>Just curious: What is AppForm?

Just the name of a global variable with the instance of a TMyMainForm. Just
as AboutFrm is the instance of the About form.

Other Threads