You are here:

AutoCAD/AutoLISP - determine screen resolution

Advertisement


Question
How can you determine the screen resolution using Autolisp?  It's important when displaying slides.  You'd like to make them in 1024x768 or higher, but what if the user has 800x600 or lower?  Then you need a lower-res slide.  Can you determine the screen resolution with Autolisp so that you can display the highest resolution slide as possible?

Answer
here's a chunk of code that will do it for you. I had the same problem already with something else.

 (vl-load-com)
 (setq acadObject (vlax-get-acad-object))
 ;make sure window is maximized
 (if (/= (vlax-get-property acadobject 'windowstate) 3)
   (vlax-put-property acadobject 'windowstate 3)
 )
 ;figure out the screen resolution
 (setq screenwidth (vlax-get-property acadobject 'width))
 (setq screenheight (vlax-get-property acadobject 'height))

AutoCAD

All Answers


Answers by Expert:


Ask Experts

Volunteer


Scott Cook

Expertise

I`ve been using AutoCAD since 1987 and programming AutoLISP nearly as long. I can answer questions about programming AutoCAD (except ARX) and production enhancement techniques. I cannot answer questions about AutoCAD crashes or DWG corruption. AutoCAD PROGRAMMING (menus, lisp) related questions only!

Experience

Since 1987. Author of Plot2000 software for for AutoCAD, http://www.plot2000.com. PROGRAMMING QUESTIONS ONLY PLEASE. Questions that are NOT related to programming or AutoCAD customization (menus and lisp only please) are outside the scope of my volunteer services and will NOT BE ANSWERED.

©2012 About.com, a part of The New York Times Company. All rights reserved.