(vl-load-com)
(defun c:Example_GraphicsWinModelBackgrndColor()
;; This example returns the current setting of
;; GraphicsWinModelBackgrndColor. It then changes the value, and finally
;; it resets the value back to the original setting.
(setq acadObj (vlax-get-acad-object))
(setq doc (vla-get-ActiveDocument acadObj))
(setq preferences (vla-get-Preferences acadObj))
;; Retrieve the current GraphicsWinModelBackgrndColor value
(setq currGraphicsWinModelBackgrndColor (vlax-variant-change-type (vla-get-GraphicsWinModelBackgrndColor (vla-get-Display preferences)) vlax-vbLong))
(alert (strcat "The current value for GraphicsWinModelBackgrndColor is " (itoa (vlax-variant-value currGraphicsWinModelBackgrndColor))))
;; Change the value for GraphicsWinModelBackgrndColor
(vla-put-GraphicsWinModelBackgrndColor (vla-get-Display preferences) (vlax-make-variant 127 19))
(setq newValue (vlax-variant-change-type (vla-get-GraphicsWinModelBackgrndColor (vla-get-Display preferences)) vlax-vbLong))
(alert (strcat "The new value for GraphicsWinModelBackgrndColor is " (itoa (vlax-variant-value newValue))))
;; Reset GraphicsWinModelBackgrndColor to its original value
(vla-put-GraphicsWinModelBackgrndColor (vla-get-Display preferences) currGraphicsWinModelBackgrndColor)
(alert (strcat "The GraphicsWinModelBackgrndColor value is reset to " (itoa (vlax-variant-value currGraphicsWinModelBackgrndColor))))
)