The question is simple. How to detect screen resolution change in Delphi ?
You only need to detect the WM_DISPLAYCHANGE
message.
For instance,
TForm1 = class(TForm)
private
protected
procedure WMDisplayChange(var Message: TWMDisplayChange);
message WM_DISPLAYCHANGE;
{ Private declarations }
public
{ Public declarations }
end;
...
procedure TForm1.WMDisplayChange(var Message: TWMDisplayChange);
begin
ShowMessageFmt('The screen resolution has changed to %d×%d×%d.',
[Message.Width, Message.Height, Message.BitsPerPixel]);
end;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With