[DUG] Detecting change in screen size

Laurence Bevan laurence at master.co.nz
Mon Aug 15 15:05:53 NZST 2011


Hi,

I'm trying to detect a change in the client screen size on a Windows tablet.
The tablet comes bundled with a toolbar application which displays along the
left side of the screen which the user can hide or display by clicking in
the taskbar area (not a particularly useful tool but users love it!!). This
cuts down the width of the screen area by about 30 pixels depending on the
resolution. I want my application to grow (or shrink) in size when they
hide/display the toolbar.

I'm using the following  code below in D7:

private 
    procedure WMDisplayChange(var Message:TMessage) ; message
WM_DISPLAYCHANGE;
...

procedure TMainForm.WMDisplayChange(var Message: TMessage) ;
 begin
    ShowMessage('Change in display size detected!') ;
    inherited;
 end;

however nothing fires when the screen area changes. My application has no
title bar or borders which I'm wondering if this is causing the problem. Any
ideas??

I could use a timer to monitor the screen work area every second or
something but I would rather get the OS to notify my app if possible.

Regards,
Laurence Bevan






More information about the Delphi mailing list