Solved

Taskbar Button is not pushed when activating a form

Posted on 2002-07-03
6
266 Views
Last Modified: 2010-04-04
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
Comment
Question by:tearsoftragedy
  • 3
  • 2
6 Comments
 
LVL 17

Accepted Solution

by:
inthe earned 200 total points
ID: 7129106
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
 
LVL 17

Expert Comment

by:geobul
ID: 7129380
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
 

Author Comment

by:tearsoftragedy
ID: 7134655
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 17

Expert Comment

by:geobul
ID: 7134686
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
 

Author Comment

by:tearsoftragedy
ID: 7144708
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
 
LVL 17

Expert Comment

by:geobul
ID: 7145475
Thanks, I've got it.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question