Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

fsstayontop form disappears when i click show desktop in winxp

Posted on 2004-10-28
11
Medium Priority
?
670 Views
Last Modified: 2010-04-05
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
0
Comment
Question by:jamesr123456
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 2
  • 2
  • +2
11 Comments
 
LVL 10

Expert Comment

by:wildzero
ID: 12439224
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
 
LVL 5

Expert Comment

by:Hypoviax
ID: 12439547
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
 
LVL 5

Expert Comment

by:Hypoviax
ID: 12439630
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
Industry Leaders: 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 5

Expert Comment

by:Hypoviax
ID: 12439647
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
 

Author Comment

by:jamesr123456
ID: 12441706
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
 
LVL 12

Accepted Solution

by:
Ivanov_G earned 1400 total points
ID: 12442070
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
 
LVL 5

Expert Comment

by:Hypoviax
ID: 12442343
Nice code Ivanov_G, it works well, i reccomend his post to be accepted,

Hypoviax
0
 
LVL 12

Expert Comment

by:esoftbg
ID: 12442345
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
 
LVL 12

Expert Comment

by:esoftbg
ID: 12442364
please remove the line:
   Style := Style AND NOT WS_CAPTION;
0
 
LVL 12

Expert Comment

by:Ivanov_G
ID: 12443200
Hypo, thanks bro :))))
0
 
LVL 5

Expert Comment

by:Hypoviax
ID: 12449289
No worries, the best answer deserves the points

Hypoviax
0

Featured Post

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.

Question has a verified solution.

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

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
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…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

650 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