fsstayontop form disappears when i click show desktop in winxp

I have a form with the style set to fsstayontop. The form stays on top until I press "show desktop" on the winxp taskbar. How can i make my form stay on top all the time?

Thanks
jamesr123456Asked:
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.

wildzeroCommented:
A 'honkey' solution could be to put a timmer on the form and set it to say 500, then on timer evet do form1.setfocus;

Not sure if that will work - but could be worth a shot ;)
0
HypoviaxCommented:
or similarly to what wildzero said:

in a timer:

form1.bringtofront;

or

application.bringtofront;

Alternatively have a look at this post for more information:

http://www.experts-exchange.com/Programming/Programming_Languages/Delphi/Q_21148766.html

You could use the left click out procedure i wrote in the post above to have form1.bringtofront instead of in a timer
0
HypoviaxCommented:
With showdesktop Windows minimises all the apps. To keep your app up use:

application.Restore;

You could put this in a timer of 100 so that when you app is minimised by showdesktop then it will automatically restore.

To minimise normally just turn of the timer when you minimise
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

HypoviaxCommented:
This is perhaps a more elegant solution :

procedure TForm1.FormCreate(Sender: TObject);

begin
  Application.OnMinimize := AppStartTimer;
end;

procedure TForm1.AppStartTimer(Sender: TObject);

begin
  Timer1.Enabled := True;
end;

procedure TForm1.Timer1Timer(Sender: TObject);

begin
  Application.Restore;
  Timer1.Enabled := False;
end;

Hypoviax
0
jamesr123456Author Commented:
hmmm. I dont really want a honkey solution. I'd like it to stop it disappearing in the first place. The taskbar can stay visible, and I have "Statbar" running at the top of my screen which also stays visible.

Im increasing the points.
0
Ivanov_GCommented:
unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
  private
    procedure OnShowDesktop (var Msg: TWMShowWindow); message WM_SHOWWINDOW;
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
begin
  Self.FormStyle := fsStayOnTop;
end;

procedure TForm1.OnShowDesktop(var Msg: TWMShowWindow);
begin
  if not Msg.Show then
    Msg.Result := 0
  else
    inherited;
end;

end.
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
HypoviaxCommented:
Nice code Ivanov_G, it works well, i reccomend his post to be accepted,

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

//........

procedure TForm2.CreateParams(var Params: TCreateParams);
begin
  inherited;
  with Params do
  begin
   ExStyle := ExStyle or WS_EX_TOPMOST;
   WndParent := GetDesktopwindow;
   Style := Style AND NOT WS_CAPTION;
 end;
end;
0
esoftbgCommented:
please remove the line:
   Style := Style AND NOT WS_CAPTION;
0
Ivanov_GCommented:
Hypo, thanks bro :))))
0
HypoviaxCommented:
No worries, the best answer deserves the points

Hypoviax
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.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.