Here's another take on the same idea that flect posted:
//
// Returns the host name and IP address
//
CString GetHostName(CString &csIPAddress)
{
   CString compName;
   _TCHAR buff[MAX_COMPUTERNAME_LENGTH + 1];
   DWORD count = MAX_COMPUTERNAME_LENGTH + 1;
   compName.Empty();
   if (::GetComputerName(buff, &count)) {
       compName = buff;
       WORD wVersionRequested;
       WSADATA wsaData;
       char name[255];
       PHOSTENT hostinfo;
       wVersionRequested = MAKEWORD( 1, 0 );
       if(WSAStartup(wVersionRequested, &wsaData) == 0) {
               if(gethostname(name, sizeof(name)) == 0) {
                   if((hostinfo = gethostbyname(name)) != NULL) {
                       csIPAddress = inet_ntoa (*(struct in_addr 
*)*hostinfo->h_addr_list);
                   }
               }
               WSACleanup( );
       }
   }
   return compName;
}
I use these includes, but I'm not sure if all of them are needed for this 
function.
#include <winsock.h>
#include <nspapi.h>
#include <winnetwk.h>
Tom
"TonyG" <TonyG@junk.com> wrote in message 
news:n52Kg.23114$gY6.22409@newssvr11.news.prodigy.com...
For the computer that my program is running on: How do I find the name of 
the computer and the computer's IP?