You can look at screen.monitors[idx] to get the coordinates of each monitor. 
Cycle through the monitor coordinates and make sure the form is in a 
respectible position on a visible monitor.

Keep in mind that monitors placed to the left of a primary monitor can 
actually have NEGATIVE coordinates.  Many apps, including the Delphi 2005 
IDE do not work properly in negative coordinates.  The Delphi 2005 IDE just 
plain freezes up if you move certain windows/palletes to a negative window. 
Photoshop even has problems.

--Jason

----- Original Message ----- 
From: "Ross Levis" <[EMAIL PROTECTED]>
To: "Delphi Discussion List" <[email protected]>
Sent: Thursday, January 19, 2006 1:26 AM
Subject: dual monitors problem


>A user with dual monitors contacted me today asking why my app will not
> load up on his right monitor.  The program stores the window position
> and size when it's closed.
>
> If the user moves the window so it is seen on both monitors, then this
> works fine when reloaded.  But if he moves it 100% into the right
> monitor then it reloads on the left monitor.
>
> I can't test this here as I only have 1 monitor.
>
> I noticed that my main form DefaultMonitor property was set to
> dmActiveForm which I thought may be the cause.  It should perhaps be set
> to dmDesktop, but then I read in the D7 help...
>
> "Note: DefaultMonitor has no effect if the application does not have a
> main form."
>
> It is the main form that is loading on the wrong monitor, and therefore
> it does not have a main form itself, so in theory changing this option
> will not have any impact on my problem.
>
> So any ideas what the problem could be?
>
> I'm storing the window position using GetWindowPlacement so the original
> non-maximized coordinates are stored.  Does this API function perhaps
> relate the window position based on the current monitor rather than the
> left monitor?
>
> Thanks,
> Ross.
>
> _______________________________________________
> Delphi mailing list -> [email protected]
> http://www.elists.org/mailman/listinfo/delphi
> 

_______________________________________________
Delphi mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi

Reply via email to