A simple idea for multi-screen support under Windows is to find the display area (enumdisplaymonitors) and move the corresponding window to the target area (Windows Api:movewindow). Here is a simple look-up display area method, grects to find the display area, Gmcount to find the number.
1 UnitEnummonitor;2 3 Interface4 uses5 multimon, Windows;6 Const7Monitor_max_count =Ten;//Maximum number of displays8 9 varTen //Display Area OneGrects:Array[0.. Monitor_max_count-1] ofTrect; A //Check the number of monitors found -Gmcount:integer =0; - the //Refresh Monitor Information - procedureRefreshmontor; - - Implementation + - var +Isfirst:boolean = True;//whether it is the first one, which is used when looking for A at functionEnummon (Amonitor:hmonitor; ADC:HDC; Arect:prect; Aparam:lparam): Boolean;stdcall; - var - Info:monitorinfo; - begin -Result: =True; - //Stop searching if the number of monitors exceeds the preset number in ifGmcount >= Monitor_max_count Then - begin toResult: =false; + Exit; - End; the *Info.cbsize: =SizeOf (monitorinfo); $ Getmonitorinfo (Amonitor, @info);Panax Notoginseng //if it is the primary monitor, it is not the first time to find, and if it is the second time, the end lookup - if(Info.dwflags = monitorinfof_primary) Then the begin + ifIsFirst Then A begin theIsFirst: =false; +Gmcount: =1; -grects[0] :=Info.rcmonitor; $Result: =True; $ Exit; - End - Else begin the //Flag Reset -IsFirst: =true;WuyiResult: =false; the End - End; Wu -Grects[gmcount]: =Info.rcmonitor; About INC (gmcount); $ End; - - procedureRefreshmontor; - begin AGmcount: =0; +IsFirst: =true; theFillchar (Grects, SizeOf (grects),0); -Enumdisplaymonitors (0,Nil, Enummon,0); $ End; the the initialization the Refreshmontor; the - Finalization inGmcount: =0; theFillchar (Grects, SizeOf (grects),0); the End.
Enummonitor.pas
Delphi Multi-screen display area lookup