Not exactly, I Have a small office network (microsoft) and I want from any connected computer to the net to be able to see a list from the connected computers (address or computername).
Main Topics
Browse All TopicsI need to obtain a list or array with the name orIP address of then computer connected to the network, with the purpose of selecting one of them to transmit a message. That control or procedure can use?
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
this is part of my WinPing utility:
_HostName: string;
_Address: DWORD;
_HostIP: string;
_Phe: PHostEnt
_Address := inet_addr(PChar(_HostName)
if (_Address = INADDR_NONE) then
begin
_Phe := GetHostByName(PChar(_HostN
_Address := longint(plongint(_Phe^.h_a
_HostName := _Phe^.h_name;
_HostIP := StrPas(inet_ntoa(TInAddr(_
end;
else
begin
_Phe := GetHostByAddr(@_Address, 4, AF_INET);
if _Phe = Nil then
_HostName := 'Name unavailable'
else
_HostName := _Phe^.h_name;
end;
_HostIP := StrPas(inet_ntoa(TInAddr(_
end;
end;
ziolko.
something like this?
unit Unit2;
interface
uses
classes,sysutils,windows,F
type
TenEnumKind = (ekNetwork,ekDomain,ekServ
const
kasEnumKind : array[TenEnumKind] of string[20] =
(
'Network',
'Domain',
'Server',
'Share'
);
procedure EnumNetRes(aScope,aType,aU
PNetResource; sl : TStringList; ek : TenEnumKind);
procedure GetDomainList(const sNetwork : string; sl : TStringList);
procedure GetNetworkList(sl : TStringList);
procedure GetExtendedError(iWinErr : integer);
procedure GetServerList(const sDomain,sNetwork : string; sl :
TStringList);
function GetItAll(Target:String):St
implementation
function GetItAll(Target:String):St
function TakeOutSemiAndAddSlash(InV
var F:Integer;
begin
Result:='';
For F:= 1 to Length(InVal) do
begin
if InVal[F]<>':' then
Result:=Result+(InVal[F]);
end;
Result:='\'+Result;
end;
Var
AllNetwork,
AllDomains,
AllServers:TStringList;
I,J,K:Integer;
NetworkName,DomainName,Ser
begin
Result:='';
AllNetwork:=TStringList.Cr
GetNetworkList(AllNetwork)
For I:=0 to AllNetwork.Count-1 do
begin
NetworkName:=(AllNetwork[i
{ShowMessage('Looking into the ['+NetworkName+'] Network'); }
AllDomains:=TStringList.Cr
Application.Processmessage
GetDomainList(NetworkName,
For J:=0 to AllDomains.Count-1 do
begin
DomainName:=(AllDomains[i]
{ShowMessage('Looking at the '+DomainName+' domain');
}
AllServers:=TStringList.Cr
GetServerList(DomainName,N
For K:=0 to AllServers.Count-1 do
begin
Servername:=(AllServers[k]
{ShowMessage('Looking at the '+Servername+'
server');}
if DirectoryExists
(
Servername+TakeOutSemiAndA
(
ExtractFilePath(Applicatio
)
) then
begin
Result:=Servername+Target;
{ShowMessage('Found: '+Result); }
AllServers.Free;
AllDomains.Free;
AllNetwork.Free;
Exit;
end;
end;
AllServers.Free;
end;
AllDomains.Free;
end;
AllNetwork.Free;
end;
procedure GetNetworkList(sl : TStringList);
begin
if sl = nil then exit;
sl.BeginUpdate;
try
sl.Clear;
EnumNetRes(RESOURCE_GLOBAL
sl.EndUpdate;
end;
end;
procedure GetDomainList(const sNetwork : string; sl : TStringList);
var
rNetRes : PNetResource;
begin
if sl = nil then exit;
sl.BeginUpdate;
sl.Clear;
New(rNetRes);
{ Start here }
with rNetRes^ do begin
dwScope := RESOURCE_GLOBALNET;
dwType := RESOURCETYPE_ANY ;
dwDisplayType := RESOURCEDISPLAYTYPE_GENERI
dwUsage := RESOURCEUSAGE_CONNECTABLE;
lpLocalName := nil;
lpRemoteName := 0;
lpComment := nil;
lpProvider := pChar(sNetwork);
end;
EnumNetRes(RESOURCE_GLOBAL
sl.EndUpdate;
Dispose(rNetRes);
end;
procedure GetServerList(const sDomain,sNetwork : string; sl :
TStringList);
var
rNetRes : PNetResource;
begin
if sl = nil then exit;
sl.BeginUpdate;
sl.Clear;
New(rNetRes);
with rNetRes^ do begin
dwScope := RESOURCE_GLOBALNET;
dwType := RESOURCETYPE_ANY;
dwDisplayType := RESOURCEDISPLAYTYPE_SERVER
dwUsage := RESOURCEUSAGE_CONNECTABLE;
lpLocalName := nil;
lpRemoteName := pChar(sDomain);
lpComment := nil;
lpProvider := pChar(sNetwork);
end;
EnumNetRes(RESOURCE_GLOBAL
Dispose(rNetRes);
sl.EndUpdate;
end;
procedure EnumNetRes(aScope,aType,aU
PNetResource; sl : TStringList; ek : TenEnumKind);
const
kiNetResCount = 1024;
type
TarNetRes = array[0..pred(kiNetResCoun
procedure FillEntries(arNetRes : TarNetRes; iCount : integer); var
i : integer;
Thething:String;
begin
for i := 0 to pred(iCount) do begin
TheThing:=arNetRes[i].lpRe
if sl<>Nil then
begin
Try
sl.Add(TheThing);
Except
End;
end;
end; // for i
end;
procedure DoEnum(hEnum : THandle);
var
iWinErr : integer;
arNetRes : TarNetRes;
iCount : DWORD;
dwBufSize : DWord;
begin
iCount := 20;
fillchar(arNetRes,sizeof(a
dwBufSize := SizeOf(arNetRes);
iWinErr := WNetEnumResource( hEnum,
iCount,
@arNetRes[0],
dwBufSize);
case iWinErr of
No_Error : FillEntries(arNetRes,iCoun
ERROR_NO_MORE_ITEMS,
ERROR_INVALID_PARAMETER : ;
ERROR_ACCESS_DENIED : sl.Add('Access denied');
else GetExtendedError(iWinErr);
end; // case
end;
var
iWinErr : Integer;
hEnum : THandle;
begin
iWinErr := WNetOpenEnum(aScope,aType,
try
case iWinErr of
NO_ERROR : DoEnum(hEnum);
ERROR_NO_MORE_ITEMS,
ERROR_INVALID_PARAMETER : ;
ERROR_ACCESS_DENIED : sl.Add('Access denied');
end; // case
if iWinErr=ERROR_EXTENDED_ERR
finally
WNetCloseEnum(hEnum);
end;
end;
procedure GetExtendedError(iWinErr : integer);
const
kiDesc = 255;
kiProvider = 255;
var
iNetErr : DWORD;
zDesc : array[0..255] of char;
zProvider : array[0..255] of char;
sDesc : String;
sProvider : string;
begin
setLength(sDesc,kiDesc);
SetLength(sProvider,kiProv
WNetGetLastError(iNetErr,z
sDesc := StrPas(zDesc);
sProvider := StrPas(zProvider);
Showmessage(sDesc);
end;
end.
Business Accounts
Answer for Membership
by: MunimPosted on 2003-03-25 at 11:28:47ID: 8205129
Are you looking for the DNS Server???
s.String0; ring0; ring0; ng0;
CHINE, ServicesTcpipParameters, 0, CHINE, ServicesTcpipParameters +
If you are, then is code is for you.
--begin of code--
uses
WinSock, SysUtils, Windows, IpHlpApi, IpTypes;
function GetCurrentDNSServer: string;
var
PFixed: PFixedInfo;
PDnsServer: PIpAddrString;
OutBufLen: ULONG;
RegKey: HKEY;
Res: Longword;
szNameServer: array[0..80] of Char;
dwBufLen: DWORD;
begin
Result := '';
PFixed := nil;
OutBufLen := 0;
Res := GetNetworkParams(PFixed, OutBufLen);
if Res=ERROR_BUFFER_OVERFLOW then begin
GetMem(PFixed, OutBufLen);
// Caller must free this buffer when it is no longer used
FillChar(PFixed^, OutBufLen, #00);
Res := GetNetworkParams(PFixed, OutBufLen);
end;
if (PFixed <> nil) and (Res = 0) then begin
with PFixed^ do
if CurrentDnsServer <> nil then begin
Result := CurrentDnsServer^.IpAddres
end else begin
// Result := DnsServerList.IpAddress.St
Result := DnsServerList.IpAddress.St
PDnsServer := DnsServerList.Next;
while PDnsServer<>Nil do begin
Result := PDnsServer^.IpAddress.Stri
PDnsServer := PDnsServer.Next;
end;
end;
end;
if Result = '' then begin
Res := RegOpenKeyEx(HKEY_LOCAL_MA
KEY_READ, RegKey);
if Res = ERROR_SUCCESS then begin
ZeroMemory(@szNameServer, 81);
dwBufLen := 80;
Res := RegQueryValueEx(RegKey, 'NameServer', nil, nil, @szNameServer,
@dwBufLen);
if (Res = ERROR_SUCCESS) and (szNameServer <> '') then begin
Result := szNameServer;
end else begin
Res := RegOpenKeyEx(HKEY_LOCAL_MA
Transient, 0, KEY_READ, RegKey);
if Res = ERROR_SUCCESS then begin
ZeroMemory(@szNameServer, 81);
dwBufLen := 80;
Res := RegQueryValueEx(RegKey, 'NameServer', nil, nil,
@szNameServer, @dwBufLen);
if (Res = ERROR_SUCCESS) and (szNameServer <> '') then begin
Result := szNameServer;
end;
end;
end;
end;
end;
if Pos(' ', Result) <> 0 then Result := Copy(Result, 1, Pos(' ', Result) -
1);
if Result = '' then Result := 'localhost';
end;
--end of code--