| You can simply get the total number of monitors by Screen.MonitorCount. If you have dual monitors, the return value of Screen.MonitorCount is 2.
Screen.Monitors[ index ] has the properties related with your multiple monitors.
Here's the simple example which measure the full screen resolution for multiple monitors. //
// Programmed 2008 by Kurapa Chunun Kang (kurapa@kurapa.com)
//
// http://kurapa.com
//
function GetScreenResolution: TRect;
var
i: Integer;
r, n: TRect;
begin
// initialize returning value
r.Left := 0;
r.Right := 0;
r.Top := 0;
r.Bottom := 0;
for i := 1 to Screen.MonitorCount do
begin
n.Left := Screen.Monitors[i-1].WorkareaRect.Left;
n.Right := Screen.Monitors[i-1].WorkareaRect.Right;
n.Top := Screen.Monitors[i-1].WorkareaRect.Top;
n.Bottom := Screen.Monitors[i-1].WorkareaRect.Bottom;
if r.Left>n.Left then r.Left := n.Left;
if r.Right<n.Right then r.Right := n.Right;
if r.Top>n.Top then r.Top := n.Top;
if r.Bottom<n.Bottom then r.Bottom := n.Bottom;
end;
Result := r;
end;
// In case of clicking button, window size is changed to the full resolution.
procedure TForm1.Button1Click(Sender: TObject);
var r: TRect;
begin
r := GetScreenResolution;
Left := r.Left;
Top := r.Top;
Width := (r.Right-r.Left);
Height := (r.Bottom-r.Top);
end;
|