[DUG] Detecting change in screen size

Rohit Gupta r.gupta at xtra.co.nz
Wed Aug 17 09:11:37 NZST 2011


Laurence,

I think the message is sent only when the resolution changes, not the 
size of the window.

Rohit

On 15/08/2011 3:05 p.m., Laurence Bevan wrote:
> 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