(defun FIND_SERIALNUMBER (DRIVE / FILSYS VAL)
(setq FILSYS (vlax-create-object "Scripting.FileSystemObject"))
;;(vlax-dump-object FILSYS t)
(setq VAL (vlax-invoke FILSYS "GetDrive" DRIVE))
;;(vlax-dump-object VAL t)
(setq VAL (vl-catch-all-apply
'vlax-get
(list VAL "SerialNumber")
)
)
(vlax-release-object FILSYS)
(if (vl-catch-all-error-p VAL)
(setq VAL NIL)
VAL
)
)
;获取网卡号
;;Test OK with XP
;;Use WMI to Get Networkadapter MAC.
;;Author : eachy [eachy@xdcad.net]
;;Web : http://www.xdcad.net
;;2005.11.22
(defun xdl-MACAddress (/ mac WMIobj serv lox sn)
(vl-load-com)
(setq mac '())
(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_NetworkAdapter "))
(vlax-for item lox
(if (and (= (vlax-get item 'NetConnectionID) "本地连接") ;中文系统
(not (member (setq sn (vlax-get item 'MACAddress)) mac))
)
(setq mac (cons sn mac))
)
)
(mapcar 'vlax-release-object (list lox serv WMIobj))
)
)
(reverse mac)
)
posted on 2008-03-11 13:31
深藏记忆 阅读(1235)
评论(0) 编辑 收藏 所属分类:
Vlisp之韵