- ;;说明:判断是否连接到网络
- ;;返回:T or nil
- (DEFUN ATX-INTERNET-P (/ OBJ RTN URL)
- (setq URL "http://baidu.com/")
- (AND (setq OBJ (vlax-get-or-create-object "winhttp.winhttprequest.5.1"))
- (NOT
- (VL-CATCH-ALL-ERROR-P
- (setq RTN (VL-CATCH-ALL-APPLY
- '(lambda ()
- (vlax-invoke OBJ 'OPEN "GET" URL :vlax-true)
- (vlax-invoke OBJ 'SEND)
- (vlax-invoke OBJ 'WAITFORRESPONSE 1)
- (vlax-get OBJ 'STATUS)
- )
- )
- )
- )
- )
- (vlax-release-object OBJ)
- (= 200 RTN)
- )
- )
|