Board index » cppbuilder » Detect Screen DPI Change

Detect Screen DPI Change


2007-05-30 06:22:58 PM
cppbuilder85
Is there some way that I can detect a change in the screens
density of pixels per inch (like when the user changes the
resolution using the ControlPanel)?
~ JD
 
 

Re:Detect Screen DPI Change

Il 30 May 2007 03:22:58 -0700, "JD" < XXXX@XXXXX.COM >ha scritto:
Quote

Is there some way that I can detect a change in the screens
density of pixels per inch (like when the user changes the
resolution using the ControlPanel)?

~ JD
You could try to see if TApplicationEvents::OnSettingChange
of the TApplicationEvents component resolves your problem.
In fact, the online help states:
<<Use OnSettingChange to respond when Windows informs the application that a
system-wide setting or policy has changed.>>
So, I think it could help you.
Regards
Giuliano
 

Re:Detect Screen DPI Change

System sends a WM_DISPLAYCHANGE message to all windows when the display
changes. see:
msdn2.microsoft.com/en-us/library/ms534847.aspx
Just intercept this message by defining your own wndproc for the main form
and looking for this message. Then you should be able to be informed when
the screen settings change
HTH
Mike
"JD" < XXXX@XXXXX.COM >wrote in message
Quote

Is there some way that I can detect a change in the screens
density of pixels per inch (like when the user changes the
resolution using the ControlPanel)?

~ JD

 

{smallsort}

Re:Detect Screen DPI Change

"Mike Collins" <its@TheBottomOfThePost>wrote:
Quote

System sends a WM_DISPLAYCHANGE message to all windows when
the display changes.
That's the way I went because only a secondary form is
interested and I wanted to keep the code encapsulated.
Using a TApplication event would break the encapsulation.
~ JD