65.9K
CodeProject is changing. Read more.
Home

System Name and IP Address

starIconstarIcon
emptyStarIcon
starIcon
emptyStarIconemptyStarIcon

2.45/5 (10 votes)

Feb 17, 2006

CPOL
viewsIcon

41160

downloadIcon

1158

Program to get System Name and IP Address

Sample Image - SystemInfo.jpg

Introduction

The application is created to get an IP Address of a system. Also it gets the name of the System.

Used DLLs are as follows:

Private Declare Function WSAGetLastError Lib "WSOCK32.DLL" () As Long
Private Declare Function WSAStartup Lib "WSOCK32.DLL" _
        (ByVal wVersionRequired&, lpWSAData As WSADATA) As Long
Private Declare Function WSACleanup Lib "WSOCK32.DLL" () As Long
Private Declare Function gethostname Lib "WSOCK32.DLL" _
        (ByVal hostname$, ByVal HostLen&) As Long
Private Declare Function gethostbyname Lib "WSOCK32.DLL" _
        (ByVal hostname$) As Long
Private Declare Sub RtlMoveMemory Lib "KERNEL32" _
        (hpvDest As Any, ByVal hpvSource&, ByVal cbCopy&)

Used const variables are as follows:

Private Const WS_VERSION_REQD = &H101
Private Const WS_VERSION_MAJOR = WS_VERSION_REQD \ &H100 And &HFF&
Private Const WS_VERSION_MINOR = WS_VERSION_REQD And &HFF&
Private Const MIN_SOCKETS_REQD = 1
Private Const SOCKET_ERROR = -1
Private Const WSADescription_Len = 256
Private Const WSASYS_Status_Len = 128

It's a simple project that will help you a little more to boost you up.

History

  • 17th February, 2006: Initial post