?
Solved

Always on Top - even after Minimize all

Posted on 2004-09-14
6
Medium Priority
?
601 Views
Last Modified: 2012-05-05
Hello there

How do I make a Delphi app that will stay on top even when all apps are minimized (with the Windows+M key).

I know it is possible because dragstrip (http://www.poppybank.com/DragStrip/windows/index.htm) does it .. it keeps a little bar docked to one side of the desktop, at all times

thanks
0
Comment
Question by:Mutley2003
[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
6 Comments
 
LVL 12

Expert Comment

by:esoftbg
ID: 12061319
unit Unit2_Q_21131390;

interface

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

type
  TForm2 = class(TForm)
    Memo: TMemo;
    Timer: TTimer;
    procedure FormShow(Sender: TObject);
    procedure TimerTimer(Sender: TObject);
  private   { Private declarations }
    procedure CreateParams(var Params: TCreateParams); override;
  public    { Public declarations }
  end;

var
  Form2: TForm2;

implementation

{$R *.dfm}

procedure TForm2.FormShow(Sender: TObject);
var
  B:      Boolean;
  L:      Integer;
  T:      Integer;
  R:      TRect;
begin
  B := False;
  SystemParametersInfo(SPI_GETWORKAREA, 0, @R, 0);
  T := R.Bottom - Height;
  L := R.Right - Width;
  if (T<>Top) then
  begin
    B := True;
    Top := T;
  end;
  if (L<>Left) then
  begin
    B := True;
    Left := L;
  end;
  if B then
  begin
    Memo.Clear;
    Memo.Lines.Add('Work area is the portion of the screen not obscured by the taskbar');
    Memo.Lines.Add('Left=' + IntToStr(R.Left));
    Memo.Lines.Add('Top=' + IntToStr(R.Top));
    Memo.Lines.Add('Right=' + IntToStr(R.Right));
    Memo.Lines.Add('Bottom=' + IntToStr(R.Bottom));
  end;
end;

procedure TForm2.TimerTimer(Sender: TObject);
begin
  FormShow(Self);
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;

end.
0
 
LVL 12

Expert Comment

by:esoftbg
ID: 12061397
download the full code of the above example from :
page:        http://www.geocities.com/esoftbg/
  link:        Q_21131390.zip
0
 
LVL 12

Accepted Solution

by:
Ivanov_G earned 2000 total points
ID: 12061723
unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
  private
    procedure OnMinimizeAll (var Msg: TWMShowWindow); message WM_SHOWWINDOW;
  public
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

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

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

end.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 34

Expert Comment

by:Slick812
ID: 12089492
hello  Mutley2003, there seems to be a solution for this at the EE question - -

http://www.experts-exchange.com/Programming/Programming_Languages/Delphi/Q_20340906.html
0
 
LVL 1

Expert Comment

by:fidel83
ID: 12859791
Ivanov_G's answer works ;-)
0
 

Author Comment

by:Mutley2003
ID: 12897228
yes, it does, and I don't know why I did not close this off before.

My apologies, people.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses
Course of the Month10 days, 19 hours left to enroll

770 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