在LISP中怎樣獲得本機讀物理序列號主板號?
可以通過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)
)