Here is a code snippet taken from Google Groups:
Code:
function TMainWin.EnumClients(tar:TStrings):DWord;
var ContinueEnumeration:boolean;
Function WNetEnumeration(PNetContainer: PNetResource):DWord;
var BufferSize,NetEntries:DWORD;
i:Integer;
NetResources:TNetResources;
NetHandle:THandle;
Text:String;
begin
Result:=WNetOpenEnum(RESOURCE_GLOBALNET,RESOURCETYPE_ANY,
RESOURCEUSAGE_CONTAINER,PNetContainer,NetHandle);
if Result<>NO_ERROR then
exit;
ContinueEnumeration:=True;
while ContinueEnumeration do
begin
NetEntries:=MaxNetResources;
BufferSize:=SizeOf(NetResources);
Result:=WNetEnumResource(NetHandle,NetEntries,@NetResources[0],BufferSize);
if Result=NO_ERROR then
begin
for i:=0 to Pred(NetEntries)do
begin
if NetResources[i].dwDisplayType=RESOURCEDISPLAYTYPE_SERVER
then
begin
text:=NetResources[i].lpRemoteName;
while Pos('\',text)=1 do
Delete(text,1,1);
tar.Add(Text+' '+GetIP(Text));
end;
if NetResources[i].dwUsage<>RESOURCEUSAGE_CONNECTABLE then
WNetEnumeration(@NetResources[i]);
end;
end
else
begin
Result:=GetLastError;
ContinueEnumeration:=Result=ERROR_MORE_DATA;
end;
end;
if NetHandle<>0 then
WNetCloseEnum(NetHandle);
end;
begin
tar.Clear;
Result:=WNetEnumeration(nil);
end;
This will give you the list of clients.
You could just set the database path in an ini file once and each client on startup would use those settings. That's more conventional than scanning the whole network for a particular resource.