http://forums.vb-world.net/showthrea...hreadid=143799

From there goto the link provided by Serge and download the code. There is a GetDomainName function in the source code.