在LISP中怎样获得本机读物理序列号、主板号? 20
2个回答
展开全部
可以通过VLISP调用WINDOWS的API函数获得,例如以下程序(获取硬盘的序列号):
(DEFUN PHYHAR (/ RET SERX OBJW LCCON LOX)
(VL-LOAD-COM)
(SETQ SERX '())
(IF (SETQ OBJW (VLAX-CREATE-OBJECT "wbemScripting.SwbemLocator"))
(PROGN
(SETQ LCCON (VLAX-INVOKE OBJW 'CONNECTSERVER "." "\\root\\cimv2" "" ""
"" "" 128 NIL
)
)
(SETQ LOX (VLAX-INVOKE LCCON 'EXECQUERY "Select SerialNumber,Tag from Win32_PhysicalMedia"))
(VLAX-FOR ITEM LOX (SETQ SERX (CONS (LIST (VLAX-GET ITEM 'TAG)
(VLAX-GET ITEM 'SERIALNUMBER)
) SERX
)
)
)
(VLAX-RELEASE-OBJECT LOX)
(VLAX-RELEASE-OBJECT LCCON)
(VLAX-RELEASE-OBJECT OBJW)
)
)
(PRINC (REVERSE SERX))
(PRINC)
)
(DEFUN PHYHAR (/ RET SERX OBJW LCCON LOX)
(VL-LOAD-COM)
(SETQ SERX '())
(IF (SETQ OBJW (VLAX-CREATE-OBJECT "wbemScripting.SwbemLocator"))
(PROGN
(SETQ LCCON (VLAX-INVOKE OBJW 'CONNECTSERVER "." "\\root\\cimv2" "" ""
"" "" 128 NIL
)
)
(SETQ LOX (VLAX-INVOKE LCCON 'EXECQUERY "Select SerialNumber,Tag from Win32_PhysicalMedia"))
(VLAX-FOR ITEM LOX (SETQ SERX (CONS (LIST (VLAX-GET ITEM 'TAG)
(VLAX-GET ITEM 'SERIALNUMBER)
) SERX
)
)
)
(VLAX-RELEASE-OBJECT LOX)
(VLAX-RELEASE-OBJECT LCCON)
(VLAX-RELEASE-OBJECT OBJW)
)
)
(PRINC (REVERSE SERX))
(PRINC)
)
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询