| 
×
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册 
     (defun _WbemGet ( class props / locator service query temp result )
    (vl-catch-all-apply 'eval
       '(   (vlax-for x
                (setq query
                    (vlax-invoke 
                        (setq service
                            (vlax-invoke 
                                (setq locator (vlax-create-object "WbemScripting.SWbemLocator"))
                                'ConnectServer "." "root\\cimv2" nil nil nil nil nil nil
                            )    
                        )
                        'ExecQuery 
                        (strcat "SELECT * FROM " class)
                    )
                )                          
                (setq temp 
                    (cons 
                        (mapcar 
                            (function (lambda (p) (vl-catch-all-apply 'vlax-get (list x p))))
                            (if (listp props) props (list props))
                        ) 
                        temp
                    )
                )       
            )       
        )
    )
    (foreach x (mapcar 'list (list query service locator))
        (vl-catch-all-apply 'vlax-release-object x)
    )
    
    (foreach l temp
        (or 
            (null (apply 'or l))
            (member l result)
            (setq result (cons l result))
        )
    )        
    (if (listp props) result (mapcar 'car result))
    
)
 (_WbemGet "Win32_Process" '(Name ExecutablePath CommandLine))
 (_WbemGet "Win32_Process" '(Name ProcessID))
 (_WbemGet "Win32_Process" 'Name)
 |