View previous topic :: View next topic |
Author |
Message |
ljfarrugia
Joined: 06 Jun 2016 Posts: 35
|
Posted: Thu Jun 09, 2016 10:11 pm Post subject: Getting Screen Resolution |
|
|
For years I have been using the API function GetSystemMetrics with Clearwin to get the current screen resolution, in order to decide on the size of graphics windows
Is there a better way?
On one of my laptops GetSytemMetrics reports a screen resolution of 1280x720, but Windows says the resolution is actually 1920x1080 |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7932 Location: Salford, UK
|
Posted: Fri Jun 10, 2016 7:07 am Post subject: |
|
|
You may need to enable DP! awareness.
If you are using the latest release and your program has done something in ClearWin+ then DPI awareness will be on (Process_System_DPI_Aware) by default (but you need to be running Windows 8.1 or later).
Otherwise you can use the call
Code: | i = SetDpiAwareness@(1) |
See cwplus.enh for details. |
|
Back to top |
|
|
ljfarrugia
Joined: 06 Jun 2016 Posts: 35
|
Posted: Fri Jun 10, 2016 4:50 pm Post subject: |
|
|
Thanks, that works perfectly
What is the effect of a call SetDpiAwareness(1) if the operating system is earlier than Win 8.1 ?, i.e. can it be used safely in any program without
checking the Windows version? |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7932 Location: Salford, UK
|
Posted: Fri Jun 10, 2016 6:49 pm Post subject: |
|
|
Yes it can be used safely. The function returns 0 if the operating system is before Windows 8.1. |
|
Back to top |
|
|
|