Board index » delphi » Showed 2 buttons in the task bar for the same application

Showed 2 buttons in the task bar for the same application

Hi,

        In my application I create a splash form and other forms
at run-time (I am using Delphi 3). The problem is that, when it is
running it is showed 2 buttons in the task bar (one for the splash form
and another for the next form displayed) instead of just one for the
application. I want to have only one button for my whole application
despite how many forms it has and despite wether the form is inside a
DLL or not.

        Does anybody know what is happening?

        Thanks,

Evandro

 

Re:Showed 2 buttons in the task bar for the same application


Hi Evandro

How is your .dpr-file? In the .dpr-file the first form created becomes
the applications main form, except the datamodule. Thus, if you declare
a splash screen before the main form, you have to do this as follows:

SplashForm := TSplashForm.Create(Application);

The main form may remains declared like original by Delphi:

Application.CreateForm(TMainForm, MainForm);

If you create other forms in this original way before the main form, the
first of them will become the applications main form. Do you have such a
construct?

By the way, each button in the Windows taskbar is for a separate
application. Do you have two projects in a project group? (But this is
only from Delphi 4 upwards, I think.)

Regards

Janos

Re:Showed 2 buttons in the task bar for the same application


You are using CreateForm in the Dll to create your from frmo the Dll more than
likely.  Dll's do not share objects with the EXE so it has its own Application
object.  When you call CreateForm there the application object will make it the
main form of the Dll causing the extra button.

Several ways to fix this. One is to just call the Dll form's Create instead of
CreateForm.  Second is to use the Exe's Application object (pass it to the dll)
instead of the Dlls.  Third and probably the best solution is to put your forms
into a package.  Packages were designed for operations like this and they share
all the exe's global objects like Application.

Quote
Evandro Bacarin wrote:

> Hi,

>         In my application I create a splash form and other forms
> at run-time (I am using Delphi 3). The problem is that, when it is
> running it is showed 2 buttons in the task bar (one for the splash form
> and another for the next form displayed) instead of just one for the
> application. I want to have only one button for my whole application
> despite how many forms it has and despite wether the form is inside a
> DLL or not.

>         Does anybody know what is happening?

>         Thanks,

> Evandro

--
Jeff Overcash (TeamB)   On waves of silver I dreamed of gold
(Please do not email    'Till I lost the peace that dreaming gives
 me directly unless     I dreamed of the moment of my own death
 asked.  Thank You)     That no one ever dreams and lives (Marillion)

Re:Showed 2 buttons in the task bar for the same application


Hi Evandro,

I read somewhere once that there is a bug in the Delphi API with Windows 95
whereby it creates a new button on the taskbar for each form rather than one
for the application.  I don't know if this will help as I'm not developing
for 95, but the workaround was as follows:-

{in the dpr file}

uses
    unit1 in 'unit1.pas' {form1}
    etc

var
   wStyle:LogInt;

begin
  wStyle:=getWindowLong(Application.Handle,GWL_Style);
  wStyle:=wStyle or ws_Caption;
  setWindowLong(Application.Handle,GWL_Style,wStyle);

{normal dpr bits continue here, including the create form statements}

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

Whether this works or not I don't know, but good luck!

Quote
Evandro Bacarin <baca...@cnptia.embrapa.br> wrote in message

news:38AA927C.7D2DCEB@cnptia.embrapa.br...
Quote
> Hi,

>         In my application I create a splash form and other forms
> at run-time (I am using Delphi 3). The problem is that, when it is
> running it is showed 2 buttons in the task bar (one for the splash form
> and another for the next form displayed) instead of just one for the
> application. I want to have only one button for my whole application
> despite how many forms it has and despite wether the form is inside a
> DLL or not.

>         Does anybody know what is happening?

>         Thanks,

> Evandro

Other Threads