type
TO_MONITOR = class hm: HMONITOR; end; function EnumMonitorsProc(hm: HMONITOR; dc: HDC; r: PRect; Data: Pointer): Boolean; stdcall; var L: TList; M: TO_MONITOR; begin L := TList(Data); M := TO_MONITOR.Create; M.hm:= hm; L.Add(M); Result := True; end; procedure TFormVedio.FormShow(Sender: TObject); var FMonitors: Tlist; l_Handle: HMONITOR; rect: trect; MonInfo: TMonitorInfo; begin FMonitors := TList.Create; EnumDisplayMonitors(0, nil, @EnumMonitorsProc, LongInt(FMonitors)); MonInfo.cbSize := SizeOf(MonInfo); GetMonitorInfo(1, @MonInfo); rect := MonInfo.rcMonitor; if FMonitors.Count > 1 then self.SetBounds(rect.Left, rect.Top, rect.Width, rect.Height); FMonitors.Free; end; //从D7的VCL源码中提取的