Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > General

Lost Password?

Reply
 
Thread Tools Display Modes
  #1  
Old 11-16-2005, 12:40 AM
digitiger digitiger is offline
Senior Member
 
Join Date: Jan 2001
Posts: 716
Default dimensions of Restored window (windowState = wsNormal)

I want to know as to what dimensions the main form of my delphi built application will resize after user clicks on "Restore" button.

I want to know this size so that I may reduce the size of MDI child form also if it is more than the client area of main form after the restore operation.

Kindly help

thanks a lot in advance
Reply With Quote
  #2  
Old 11-16-2005, 03:05 AM
chris_w chris_w is offline
Senior Member
 
Join Date: Jan 2004
Posts: 1,397
Default RE: dimensions of Restored window (windowState = wsNormal)

[pre]
Code:
procedure TForm1.Button1Click(Sender: TObject);
var
  WP : TWindowPlacement;
  pWP : PWindowPlacement;
  desktop : TRect;
begin
  FillChar(WP, SizeOf(WP), 0);
  WP.length := SizeOf(WP);
  pWP := @WP;
  if GetWindowPlacement(Handle, pWP) then begin
    //GetWindowPlacement returns coords relative to the desktop
    desktop := Screen.DesktopRect;
    OffsetRect(WP.rcNormalPosition, desktop.Left, desktop.Top);

    ShowMessage( Format('%.0d, %.0d, %.0d, %.0d',
                        [WP.rcNormalPosition.Left,
                         WP.rcNormalPosition.Top,
                         WP.rcNormalPosition.Right,
                         WP.rcNormalPosition.Bottom]) );
  end;
end;
[/pre]

Chris
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT. The time now is 09:19 PM.


Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2019, vBulletin Solutions, Inc.