Главная страница | назад





Article #17879: Detecting display changes.

 Question and Answer Database
FAQ2879D.txt Detecting display changes.
Category :Object Pascal
Platform :All
Product :All 32 bit
Question:
How do I detect, and how should I handle dynamic changes
in the display?
Answer:
To detect changes in the display, create a message handler
to trap the WM_DISPLAYCHANGE message. If you have a
simple application, you may need to do little in response to
this message. If your application makes use of graphics, you
may want to restart the application, as there may be many
changes to the system that may be difficult to overcome as
the screen resolution, color depth and default fonts may
change.
Here is an example of of a message handler:
type
TForm1 = class(TForm)
Button1: TButton;
private
{ Private declarations }
procedure WMDisplayChange(var Message: TMessage);
message WM_DISPLAYCHANGE;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.WMDisplayChange(var Message: TMessage);
begin
{Do Something here}
inherited;
end;
7/16/98 4:31:28 PM

Last Modified: 01-SEP-99