Recent

Author Topic: Ubuntu 22.04.1 LTS, Lazarus 2.2.0 The GetMonitorInfo function returns a strange  (Read 750 times)

dmitryb

  • Jr. Member
  • **
  • Posts: 62
Ubuntu 22.04.1 LTS,
Lazarus 2.2.0+dfsg1-5ubuntu1 (rev Debian package 2.2.0+dfsg1-5ubuntu1) FPC 3.2.2 x86_64-linux-gtk2
The GetMonitorInfo function returns a strange result.


Code: Pascal  [Select][+][-]
  1. WorkArea.Left = 74 : WorkArea.Top = 1894866587 : WorkArea.Right = 1600 : WorkArea.Bottom = 1894867579
  2.  


Code: Pascal  [Select][+][-]
  1. procedure TForm1.Button4Click(Sender: TObject);
  2. var
  3.   MasterAbsRect: TRect;
  4.   MonInfo: TMonitorInfo;
  5.   Result: Boolean;
  6.   WorkArea: TRect;
  7. begin
  8.   MasterAbsRect := Rect(Left, Top, Left + Width, Top + Height);
  9.   MonInfo.cbSize := SizeOf(TMonitorInfo);
  10.   Result := GetMonitorInfo(MonitorFromRect(@MasterAbsRect, MONITOR_DEFAULTTONEAREST), @MonInfo);
  11.   if (Result) then
  12.   begin
  13.     WorkArea := MonInfo.rcWork;
  14.     Edit1.Text := 'WorkArea.Left = ' + WorkArea.Left.ToString +
  15.                   ' : WorkArea.Top = ' + WorkArea.Top.ToString +
  16.                   ' : WorkArea.Right = ' + WorkArea.Right.ToString +
  17.                   ' : WorkArea.Bottom = ' + WorkArea.Bottom.ToString;
  18.  
  19.   end;
  20. end;
  21.  


 

TinyPortal © 2005-2018