Solved

Always on Top - even after Minimize all

Posted on 2004-09-14
6
596 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
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 500 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 33

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Run video youtube webbrowse 10 58
Delphi 2 50
Adoquery sql  left join does not work 25 80
How do I add a client SSL certificate to a SOAP client in Rad Studio Delphi? 2 43
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

867 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

12 Experts available now in Live!

Get 1:1 Help Now