21-06-2019, 11:12 PM
لم اجربه ولكن يبدوا ان به حل معقول الى جانب الحلول التي ناقشناها من قبل
كود :
Function TfrmMMAMainForm.MonitorProfile: String;
Const
strMask = '%d=%dDPI(%s,%d,%d,%d,%d)';
Var
iMonitor: Integer;
M: TMonitor;
Begin
Result := '';
For iMonitor := 0 To Screen.MonitorCount - 1 Do
Begin
If Result <> '' Then
Result := Result + ':';
M := Screen.Monitors[iMonitor];
Result := Result + Format(strMask, [
M.MonitorNum,
M.PixelsPerInch,
BoolToStr(M.Primary, True),
M.Left,
M.Top,
M.Width,
M.Height
]);
End;
End;كود :
Procedure TfrmMMAMainForm.SaveSettings;
Var
strMonitorProfile : String;
recWndPlmt : TWindowPlacement;
Begin
strMonitorProfile := MonitorProfile;
recWndPlmt.Length := SizeOf(TWindowPlacement);
GetWindowPlacement(Handle, @recWndPlmt);
FINIFile.WriteInteger(strMonitorProfile, 'Top', recWndPlmt.rcNormalPosition.Top);
FINIFile.WriteInteger(strMonitorProfile, 'Left', recWndPlmt.rcNormalPosition.Left);
FINIFile.WriteInteger(strMonitorProfile, 'Height', recWndPlmt.rcNormalPosition.Height);
FINIFile.WriteInteger(strMonitorProfile, 'Width', recWndPlmt.rcNormalPosition.Width);
FINIFile.WriteInteger(strMonitorProfile, 'WindowState', recWndPlmt.showCmd);
FINIFile.Save;
End;كود :
Procedure TfrmMMAMainForm.LoadSettings;
Var
strMonitorProfile : String;
recWndPlmt : TWindowPlacement;
Begin
strMonitorProfile := MonitorProfile;
recWndPlmt.Length := SizeOf(TWindowPlacement);
recWndPlmt.rcNormalPosition.Top := FINIFile.ReadInteger(strMonitorProfile, 'Top', 100);
recWndPlmt.rcNormalPosition.Left := FINIFile.ReadInteger(strMonitorProfile, 'Left', 100);
recWndPlmt.rcNormalPosition.Height := FINIFile.ReadInteger(strMonitorProfile, 'Height', 480);
recWndPlmt.rcNormalPosition.Width := FINIFile.ReadInteger(strMonitorProfile, 'Width', 640);
recWndPlmt.showCMD := FINIFile.ReadInteger(strMonitorProfile, 'WindowState', SW_NORMAL);
SetWindowPlacement(Handle, @recWndPlmt);
End;كود :
https://www.davidghoyle.co.uk/WordPress/?p=2100