GetScreenRes 1.0

0 Likes

By Bryan Keadle



GetScreenRes is a simple utility that will create registry keys and temporary files to indicate a person's current screen resolution. What's the point? Perhaps you have some scripting you'd like to do and need to know, programmatically, what the user's current screen resolution is; or perhaps you want to have a conditional application object based on the user's screen resolution.



For example, I have a couple application objects to allow users to set their screen resolution to a few pre-defined standard sizes - so they can have a choice of screen resolutions, but without giving them access to Windows' Display settings (and potentially selecting an unsupported resolution). I wanted a way to show the application objects of the resolution choices that *didn't* include their existing resolution. This graphic shows the available screen resolutions, excluding the 1024x768 option because that's the resolution currently set:






Also, for another project, I wanted to know what size of a particular watermark graphic to copy to their local workstation that matches their current screen resolution.



GetScreenRes makes this screen resolution information easily accessible. It creates the following registry keys (using 1024x768 resolution as an example):



[HKEY_LOCAL_MACHINE\SOFTWARE\KeadleWorks]
"ScreenResolutionX"="1024"
"ScreenResolutionY"="768"


And creates the following files:



%TEMP%\ScreenRes\1024x768
%TEMP%\ScreenRes.txt


both files containing the text:



1024x768


So you have 3 different ways to read this screen information, whatever works best for you for certain situations.



As for my NAL object example above, I simply ForceRun GetScreenRes to run upon login, and my Screen Resolution objects are dependent on the registry key value to *NOT* equal the resolution it is set for:







Tags:

Labels:

How To-Best Practice
Collateral
Comment List
Anonymous
Related Discussions
Recommended