Link to home
Start Free TrialLog in
Avatar of tearsoftragedy
tearsoftragedy

asked on

Taskbar Button is not pushed when activating a form

Hi!

I have a main form which creates more windows at run time, every window have in the CreateParams the WS_EX_APPWINDOW style in order to have a button in the taksbar for each new form created.

Problem is that, when i click the window the associated taskbar button is not pressed,  if i activate the windows by clicking the associated taskbar button everything goes fine, but never clicking each form....

How can i make the button goes pushed?  i think that there's some message the windows are not sending since they weren't meant to have a taskbar button...


Thanks!
ASKER CERTIFIED SOLUTION
Avatar of inthe
inthe

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of geobul
geobul

Hi,
I don't use CreateParams. Try the following instead:

procedure TForm1.Button1Click(Sender: TObject);
begin
  SetWindowLong(Form2.Handle, GWL_EXSTYLE, WS_EX_APPWINDOW);
  Form2.Show;
end;

Regards, Geo
Avatar of tearsoftragedy

ASKER

Sorry for the delay Inthe, it works as i need, how easy it was ;)

thanks for your time!

:]


-----
geobul:
thanks for answering too, but i begun with the code you supplied, then i changed the params i thought i was the best place...


--
;D
I'm afraid that I can't manage it working properly as I expect setting WndParent in CreateParams. I'm using Delphi 5 Ent and WinXP. But most important is that you can.

Regards, Geo
this is the code Geo, try and see if it works now.. maybe you missed something... ¿?

.....
  protected
    procedure CreateParams(var Params: TCreateParams); override;


.....

procedure TYourMDI.CreateParams(var Params: TCreateParams);
begin
  inherited;
  Params.ExStyle := Params.ExStyle or WS_EX_APPWINDOW;
  Params.WndParent := GetDesktopWindow;
end;
Thanks, I've got it.