Hi all,..
I know there is some code to find the IP address.
but there is some others ( just sharing).
(defun c:getip ( / WMI CSERV EXQ gip)
(vl-load-com)
(setq WMI (vlax-create-object "WbemScripting.SWbemLocator"))
(setq CSERV (VLAX-INVOKE WMI 'ConnectServer "." "\\root\\cimv2" nil nil nil nil nil nil))
(setq EXQ (vlax-invoke CSERV 'ExecQuery "Select * From Win32_NetworkAdapterConfiguration Where IPEnabled = true"))
(vlax-for item EXQ
(setq gip (vlax-get item 'IPAddress))
)
(vlax-release-object wmi)
(vlax-release-object CSERV)
(vlax-release-object EXQ)
gip
)
(defun c:getip2 ( / IP Domain dhcpSubnet TheIP)
(vl-load-com)
(foreach guid (vl-registry-descendents (setq loc "HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\TCPIP\\Parameters\\Interfaces\\"))
(if (and
(setq Domain (vl-registry-read (strcat loc guid) "DhcpDomain"))
(setq IP (vl-registry-read (strcat loc guid) "DhcpIPAddress"))
(not (vl-registry-read (strcat loc guid) "DhcpNetworkHint"))
(setq dhcpSubnet (vl-registry-read (strcat loc guid) "DhcpSubnetMask"))
(= dhcpSubnet "255.255.255.0")
)
(setq TheIP IP)
)
)
theIP
)