TechTricks
Technical answers from the trenches 
 
 
 
 

     
   
Detecting Screen Resolution via ObjectPAL
 
   
by Lance Leonard 
 Posted: I August 2000
 
   
 
 Applies to: Paradox 7.32 and later
 
   
 
Audience: Intermediate
 
       
   

Question: I've developed my forms for a specific screen resolution. How can I determine if my users' displays will handle this??

Answer: The sysInfo() procedure provides two settings that report the screen resoltion. ScreenWdith contains the width of the user's screen and ScreenHeight reports its height. Both value represent the number of pixels involved.

You incorporate this into your application by calling sysInfo() at an appropriate time, probably after the default behavior of the open() event in the first form you diplay in your application.

The following code is a custom method taken from a script designed to report your current screen resolution.

method getScreenRes() recScreenRes
;---------------------------------------------------------------
; Returns the current screen resolution using a custom type
; declared in the Type method.
;---------------------------------------------------------------
var
   rsrCurrent  recScreenRes        ; Current Screen Resolution
   datSysInfo  dynArray[] Anytype  ; Current System Settings
endVar

   sysInfo( datSysInfo )
   rsrCurrent.Width  = datSysInfo[ "ScreenWidth" ]
   rsrCurrent.Height = datSysInfo[ "ScreenHeight" ]
   return rsrCurrent

endMethod

[Download Script]

The above method returns its results as a custom record type, declared at the same level as the custom method:

Type
   recScreenRes =
      record
         Width   LongInt
         Height  LongInt
      endRecord
endType

If you wish to adapt this script for your own use, be sure to include the custom method and the Type declaration.

 

       

Top

Feedback About Paradox Delphi Assorted Web Stuff
 
 
Copyright © 2000-2004, techtricks.com; All Rights Reserved.
Acknowledgements, Disclaimers, Terms and Conditions.
Article last updated on 31 May 2003

 

Other Sites: Paradox, Delphi, Perl, Web Stuff, and More


 

[- End -]