;;Test OK with XP
;;Use WMI to Get OS name
;;Author : eachy [eachy@xdcad.net]
;;Web : http://www.xdcad.net
;;2005.11.22
(defun xdl-GetOSName (/ IDs WMIobj serv lox sn)
(vl-load-com)
(setq IDs '())
(if (SETQ WMIobj (VLAX-CREATE-OBJECT "wbemScripting.SwbemLocator"))
(progn
(SETQ serv (VLAX-INVOKE
WMIobj 'ConnectServer "."
"\\root\\cimv2" "" ""
"" "" 128 nil
)
)
(setq lox (vlax-invoke
serv
'ExecQuery
"Select * from Win32_OperatingSystem"
)
)
(vlax-for item lox
(if (not
(member (setq sn (vlax-get item 'Caption)) IDs)
)
(setq IDs (cons sn IDs))
)
)
(setq a (mapcar 'vlax-release-object (list lox serv WMIobj)))
)
)
(reverse IDs)
)
;;from wkai@xdcad.net
;;20050929
;;功能 :获取WINDOWS系统关键文件夹路径
;;参数folder:系统文件夹名称
;;返回值 :该文件夹所在的路径
;;示例:(XDL-WINPATH-OF "Desktop")
;; --->>"D:\\Personal\\Desktop"
;; (XDL-WINPATH-OF "SendTo")
;; --->>"C:\\Documents and Settings\\Administrator\\SendTo"
;;;测试
;;;
;;;(setq winpathlst
;;; '("AppData" "Cookies" "Desktop" "Favorites" "NetHood"
;;; "Personal" "My Pictures" "PrintHood" "Recent" "SendTo"
;;; "Start Menu" "Templates" "Programs" "Startup" "Local Settings"
;;; "Local AppData" "Cache" "History" "Fonts"))
;;;(mapcar 'print(mapcar 'XDL-WINPATH-OF winpathlst ))
;;;(princ)
(defun XDL-WINPATH-OF(folder)
(vl-registry-read "HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders" folder)
)
posted on 2008-03-10 14:24
深藏记忆 阅读(95)
评论(0) 编辑 收藏 所属分类:
Vlisp之韵