how did the child window has owned icon on taskbar?

As you know, if a form is not mainform, it has not his owned icon on windows taskbar, so, how can a child form has his ownde icon on taskbar?
cakkAsked:
Who is Participating?
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.

intheCommented:
hi,
make the second(child forms) look like this:

unit Unit2;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;

type
  TForm2 = class(TForm)
  private
    { Private declarations }
  procedure CreateParams(var Params : TCreateParams); override;
  public
    { Public declarations }
  end;

var
  Form2: TForm2;

implementation

{$R *.DFM}

procedure TForm2.CreateParams(var Params : TCreateParams);
begin
  inherited CreateParams(Params); Params.WndParent := GetDesktopWindow;
end;

end.

Regards Barry
0

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
mgrCommented:
Hi

I'm not sure what the person was try to ask, but if it was to have a child form of a main form to have it's own button with an icon appear on the Task Bar then maybe this is the answer...  

unit Unit2;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;

type
  TForm2 = class(TForm)
  private
    { Private declarations }
    procedure CreateParams(var Params:
              TCreateParams); override;
  public
    { Public declarations }
  end;

var
  Form2: TForm2;

implementation

{$R *.DFM}

procedure TForm2.CreateParams(var Params: TCreateParams);
begin
  inherited CreateParams(Params);
  with params do
    begin
      // This will keep child on top of parent.
      Style   := Style or WS_OVERLAPPED;
      // This gives child it's own button and icon on taskbar,
      // even when child form is minimized.
      ExStyle := ExStyle or WS_EX_APPWINDOW;
    end;  
end;

end.

I don't when a person is to answer a question around here, but he my answer anyway. Hope it's what you want.

Marry Xmas!
Chris
0
intheCommented:
my answer does the same thing ,that why i put it as answer ...
0
mgrCommented:
Yes inthe,

  Your code does do what was asked of
it, but my code is just another way of
doing the same thing.

Plus my code has the added benefit of
the Overlapped child form Style, so
when a click on the main form happens,
the child form won't get covered over
by the main form during the focus change. (Only tested on Win95)

I've used this code in an App I've done
where the Main Form is maximized to full
screen and the Child Forms sit on top,
each child form can cover any other
child form, but the main form cann't
cover any of the child forms.

When I tried your code it aloud me to
cover the child forms with the main
(parent) form when focus move to the
parent form or when I click on the parent form. (whatever)

Oh well just trying to help...

Chris A.K.A. MGR


0
mgrCommented:
Oops!

Before you go and shoot me, I need
to add one line of code...

procedure TForm2.CreateParams(var Params: TCreateParams);
begin
  inherited CreateParams(Params);
 
  with params do
    begin
 
      // This will keep child on top of parent.
      Style     := Style or WS_OVERLAPPED;
 
      // This gives child it's own button and icon on taskbar,
      // even when child form is minimized.
      ExStyle   := ExStyle or WS_EX_APPWINDOW;

      // Form1 is the Main Form, parent.
      WndParent := Form1.Handle;
    end;    
end;

O.K. now you can shoot******

Merry Xmas & Happy New Year...

Chris A.K.A. MGR


0
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
Delphi

From novice to tech pro — start learning today.