- - * - WhiteUnicorn - * - -




* #WhiteUnicorn/ StartPage/ Documentation/DelphiFAQ >


Frequently Asked Questions

Detecting display changes.

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;




* #WhiteUnicorn/ StartPage/ Documentation/DelphiFAQ >



- - * - Anastasija aka WhiteUnicorn - * - - LJLiveJournal
PFPhotoFile