WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Get IP Address

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

IP Address grabbing. Accomplished.

Keywords:     wxHost2Addr  WinSysInfo()  MAC IP address

I found a way to show a machines IP address. I don't know if anyone has posted this yet, so here is my version.
	;;;; Get IP-Address of Computer
	AddExtender("WWWSK34I.DLL")
	_info=WinSysInfo()
	_host=ItemExtract(1,_info,@tab)
	_hostaddr=wxHost2Addr(_host)
	Message(_host,_hostaddr)
This works very very well for most users. However, another user got a GPF error with this code using a computername of "HOBBES".

There is a buglet in the extender that causes the crash. It still will not give a good answer for HOBBES.

Take a look in your tcp/ip network DNS settings and see that you have for hostname. If it is not HOBBES, use whatever is there (or change whatever is there to HOBBES).

Perhaps the luck was that computername and hostname are defined the same on a lot of machines, but they are distinctly different items. So to make this work we need the hostname, not the computername. So how to get hostname? Hmmm. Lets try...

	;debug(1)
	;;;; Get IP-Address of Computer
	AddExtender("wwwsk34I.dll")
	_host=RegQueryValue(@REGMACHINE,"System\CurrentControlSet\Services\VxD\MSTCP[HostName]")
	_domain=RegQueryValue(@REGMACHINE,"System\CurrentControlSet\Services\VxD\MSTCP[Domain]")
	_hostaddr=wxHost2Addr(StrCat(_host,".",_domain))
	Message(_host,_hostaddr)

You must specify the FULL host and domain... That works.
Article ID:   W12340
Filename:   Get IP Address Accomplished - Reg and WinSysInfo Method.txt
File Created: 2001:03:01:15:08:48
Last Updated: 2001:03:01:15:08:48