68413

Delphi Form Restored State Position and Size

Question:

In a maximized delphi form, how to get form's restored state position and size? I know in .NET we use RestoreBounds and DesktopBound.

Answer1:

This is not exposed by the VCL framework. Instead you need to dip into the Win32 API. The function you need is <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/ms633518.aspx" rel="nofollow">GetWindowPlacement</a>.

var WindowPlacement: TWindowPlacement; .... WindowPlacement.length := SizeOf(WindowPlacement); Win32Check(GetWindowPlacement(Form.Handle, WindowPlacement));

The information you need can be found in the WindowPlacement struct. Do beware that the coordinates are reported with respect to the work area rather than the screen.

Generally you want this information so that you can restore it at a later date. Use SetWindowPlacement to do that.

Recommend

  • Delphi XE2 VCL styles, How to disable VCL styles on TBitBtn?
  • Why LayoutInflater does not work in my case?
  • Delphi: Is system menu opened?
  • Minimize form in Firemonkey application
  • How to have an EditText stuck to the soft Keyboard on Android
  • Rails - Redundant RESTFUL Actions for map.resources? (new, create)
  • nodejs tls session id
  • PHP OCI8 extensions not working with PHP 7 64 bit
  • Share HttpContext code between web and non-web application
  • Gracefull shutdown for Spring boot Application
  • Using JNA to Get NSWindow from JComponent on mac
  • Android layouts for same density different diagonal length
  • Theme-ing applications in Delphi XE
  • UIPageViewController delegate method similar to scrollViewDidScroll:(UIScrollview*)scrollview
  • Why are the debugger memory windows not available in VS 2015?
  • Null ImageView Reference
  • how does System.Web.HttpRequest::PathInfo work?
  • Scala multiline string placeholder
  • Does Mobilefirst provide a provision to access web services directly?
  • Exchange data b/w iOS devices using Bluetooth 4.0
  • Can I have the cursor start on a particular column by default in jqgrid's edit mode?
  • 'TypeError' while using NSGA2 to solve Multi-objective prob. from pyopt-sparse in OpenMDAO
  • How to limit post in wp_query
  • Websockets service method fails during R startup
  • RestKit - RKRequestDelegate does not exist
  • bootstrap to use multiple ng-app
  • Comma separated Values
  • How to delete a row from a dynamic generate table using jquery?
  • Revoking OAuth Access Token Results in 404 Not Found
  • How to set the response of a form post action to a iframe source?
  • Authorize attributes not working in MVC 4
  • python draw pie shapes with colour filled
  • Are Kotlin's Float, Int etc optimised to built-in types in the JVM? [duplicate]
  • EntityFramework adding new object to nested object collection
  • Running Map reduces the dimensions of the matrices
  • Reading document lines to the user (python)
  • Binding checkboxes to object values in AngularJs
  • Net Present Value in Excel for Grouped Recurring CF
  • jQuery Masonry / Isotope and fluid images: Momentary overlap on window resize
  • How to load view controller without button in storyboard?