Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I select the monitor where I want to open my application? [duplicate]

Possible Duplicate:
Start program on a second monitor?

I have two monitor a monitor connected to my laptop. How can I choose the monitor where my application will show?

Also how can I detect how many monitor do I have connected so that I can select one ?

Thanks

like image 441
Jlouro Avatar asked Sep 18 '10 14:09

Jlouro


People also ask

How do you change which screen an application opens on?

Hold down the windows key and use the cursors to move the window around where you want it. If it's on the left monitor and you want it on the right, hold down windows key + press right arrow key and it'll shift across the screen.

How do I change my screen settings for duplicates?

Change to duplicate screen via Display SettingsRight-click anywhere on your desktop, then select Display settings. In the Display settings, scroll down until you see the Multiple displays option. Click on the drop-down menu and select “Duplicate these displays” to duplicate the primary screen on all displays.


1 Answers

Use the Screen object.

Getting the monitor count

ShowMessage(IntToStr(Screen.MonitorCount))

Getting monitor details

Screen.Monitors[i].Left (integer)
                  .Top (integer)
                  .Width (integer)
                  .Height (integer)
                  .BoundsRect (TRect)
                  .WorkareaRect (TRect)
                  .Primary (boolean)

where i is the index of the monitor, that is, i = 0, 1, ..., Screen.MonitorCount - 1.

So, for instance, to make the form occupy the entire ith monitor, use

BoundsRect := Screen.Monitors[i].BoundsRect; // or you could make the rect smaller
WindowState := wsMaximized; // possibly
like image 153
Andreas Rejbrand Avatar answered Oct 05 '22 09:10

Andreas Rejbrand