Solved

Desktop boundaries

Posted on 2001-07-19
3
170 Views
Last Modified: 2010-04-06
Howdy guys!

I need to position my form at the bottom right corner of the screen. I got that working through:

  Top := Screen.Height-Height-Y;
  Left := Screen.Width-Width-X;

But when I have for example ICQ at the right-hand corner, "attached" to the edge of the screen, my form is still in the same position, but blocked behind the ICQ window. Thus I'll need the coordinates of the desktop area.

Or if anyone has any other idea of something that would fix this, I'd be happy if you'd share it. =)


Have a nice day! :o)

Johan
0
Comment
Question by:sageryd
3 Comments
 

Expert Comment

by:Richard_Yu
ID: 6297416
In my program I set my main form's position by add the following code in FormCreate:

Self.Top := Screen.Height - 28 - Self.Height;//28 is the height of Windows task bar
Self.Left := Screen.Width - Self.Width;

It work's fine so I think it maybe useful for you.
0
 
LVL 13

Accepted Solution

by:
Epsylon earned 20 total points
ID: 6297438
Try this:

var rect: TRect;
begin
  SystemParametersInfo(SPI_GETWORKAREA, 0, @rect, 0);
  Label1.Caption := IntToStr(rect.Left);
  Label2.Caption := IntToStr(rect.Top);
  Label3.Caption := IntToStr(rect.Right);
  Label4.Caption := IntToStr(rect.Bottom);
end;
0
 
LVL 1

Author Comment

by:sageryd
ID: 6297531
Thanx! Works excellent.

var Rect: TRect;
begin
  SystemParametersInfo(SPI_GETWORKAREA, 0, @rect, 0);
  Top := Rect.Bottom-Height-5;
  Left := Rect.Right-Width-5;
end;


Richard, the height of the taskbar can vary.
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

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 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…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

863 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

23 Experts available now in Live!

Get 1:1 Help Now