Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 355551
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T12:01:42+00:00 2026-05-12T12:01:42+00:00

With Screen.DesktopHeight and Screen.DesktopWidth, I can get the size of the virtual desktop and

  • 0

With Screen.DesktopHeight and Screen.DesktopWidth, I can get the size of the “virtual” desktop and I believe that works for one or multiple monitors.

I save the position (top and left) and size (height and width) of my application into the registry when it closes. When it opens, I want to ensure it is entirely visible, since it may have been moved partly outside the visible area, or the screen size may have changed for example via screen settings or removal of a monitor.

I can basically do it with this code:

if MyForm.Width > screen.DesktopWidth then 
  MyForm.Width := screen.DesktopWidth;

if MyForm.Height > screen.DesktopHeight then 
  MyForm.Height := screen.DesktopHeight;

if (MyForm.Left + MyForm.Width) > screen.DesktopWidth then 
  MyForm.Left := screen.DesktopWidth - MyForm.Width;
if MyForm.Left < 0 then MyForm.Left := 0;

if (MyForm.Top + LogoAppForm.Height) > screen.DesktopHeight then 
  MyForm.Top := screen.DesktopHeight - LogoAppForm.Height;
if MyForm.Top < 0 then MyFormTop := 0;

This works okay, except it does not take into account the taskbar that is usually (but not always) at the bottom of the desktop. So if the taskbar is in the way of my application’s window, my application gets obscured.

How can I get the usable position and size settings of the screen that exclude the location of the taskbar?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T12:01:43+00:00Added an answer on May 12, 2026 at 12:01 pm

    I’m not sure that Windows really works the way you think it does – I have multiple monitors, but they don’t have the same height – so my desktop doesn’t have a uniform height across all monitors.

    What I do is to use Screen.MonitorCount and the Screen.Monitors array to work out which monitor contains most of the window and then find a suitable rectangle on that screen. The WorkareaRect property of TMonitor gives you the bounds of the working area on a particular monitor, which excludes any taskbars or toolbars.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Screen shot below, reads data from some database - I think I can get
I am building a screen clipping app. So far: I can get the html
QDesktopWidget * screen = QApplication::desktop(); QRect size = screen->availableGeometry(this); The documentation says, What is
I have 9 screen coordinates, each representing one of 9 positions. From the top
My screen size is 600px * 800px . I created some wallpapers whose sizes
My screen resolution is 1240x768 but the only media query that detects in my
First screen user is ask to select different buttons that are categories then after
I have home screen widget that shows images. Images are switching for some scenario.
This screen is iBooks app on my iPhone. And you can see the view
I'm writing a screen saver type app that needs to stop the user from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.