Solved

Taskbar Button is not pushed when activating a form

Posted on 2002-07-03
6
260 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
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

759 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now