Like this?
(defun c:effh (/ a c d)
;; RJP » 2020-11-16
(vlax-for l (vla-get-layers (setq d (vla-get-activedocument (vlax-get-acad-object))))
(cond ((= -1 (vlax-get l 'lock)) (vlax-put l 'lock 0) (setq a (cons l a))))
)
(vlax-for b (vla-get-blocks d)
;; This line will only process block definitions
(if (= 0 (vlax-get b 'isxref) (vlax-get b 'islayout))
(vlax-for o b
(cond ((and (vlax-write-enabled-p o) (wcmatch (vla-get-objectname o) "AcDbHatch"))
(setq c (vla-get-backgroundcolor o))
(vla-setrgb c 0 0 0)
(vla-put-backgroundcolor o c)
)
)
)
)
)
(foreach l a (vlax-put l 'lock -1))
(vla-regen d acallviewports)
(princ)
)