Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 273
  • Last Modified:

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!
0
tearsoftragedy
Asked:
tearsoftragedy
  • 3
  • 2
1 Solution
 
intheCommented:
hi,
make your other forms createparams like so:
(the Params.WndParent := GetDesktopWindow will give you the button in taskbar that will be depressed when you select the form on screen)

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;
0
 
geobulCommented:
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
0
 
tearsoftragedyAuthor Commented:
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
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
geobulCommented:
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
0
 
tearsoftragedyAuthor Commented:
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;
0
 
geobulCommented:
Thanks, I've got it.
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now