Google групе више не подржавају нове Usenet постове ни праћења. Претходни садржај остаје видљив.

Check for LAN

2 прегледа
Пређи на прву непрочитану поруку

Marc Scheuner

непрочитано,
25. 8. 1998. 03:00:0025.8.98.
Is there an easy way in Delphi (some Win32 API call) to check whether
or not I'm on a LAN? I searched on developers.href.com, but couldn't
find any helpful messages.......

I found various things, like checking for your username, or retrieving
logon information from the registry, but they can all fail if you
consider a dockable notebook: there might be information available in
the registry that is needed *IF* the notebook is on a LAN, but how can
I check if it really is connected or not?

Any hints are most welcome!

Marc

--------------------------------------------------------------------------
Marc Scheuner Berner Versicherungen, Dept. ISV
May the Source be With You Laupenstrasse 27
marc.s...@berner.ch CH-3001 BERNE, Switzerland
--------------------------------------------------------------------------

Ernie Deel

непрочитано,
25. 8. 1998. 03:00:0025.8.98.
Marc Scheuner wrote in message
<35e28912...@news.bernoise.ch>...

>there might be information available in
>the registry that is needed *IF* the notebook is on a LAN, but how
can
>I check if it really is connected or not?

The only way to determine this is to attempt to access the network.
Try reading the free space on a shared drive for example. If you
succeed, you are obviously connected.

Software should consider that the physical LAN connection can be
interrupted at any time for many different reasons. It would be nice
if the LAN adaptor had some sort of connection indicator but it does
not. Without hardware support, software is helpless.

--
Ernie Deel, EFD Systems
-----------------------------------------------
A computer can solve any problem ...
... except those that just don't add up.


Allen Drennan

непрочитано,
27. 8. 1998. 03:00:0027.8.98.
You could do something like the following, or a variation --
where MAXNEIGHBORS is a large number.

function NetAvailable:Boolean;

var
NetRes:Array[0..MAX_NEIGHBORS] of TNetResource;
NNError, hEnum, EntryCount, NetResLen: DWORD;
loop1:Integer;

begin
hEnum:=-1;
Result:=FALSE;
try
NNError:=WNetOpenEnum(RESOURCE_GLOBALNET, RESOURCETYPE_ANY, 0 ,
NIL, hEnum);
if NNError=NO_ERROR then
begin
while NNError<>ERROR_NO_MORE_ITEMS do
begin
EntryCount:=1;
NetResLen:=SizeOf(NetRes);
NNError:=WNetEnumResource(hEnum,EntryCount,@NetRes,NetResLen)
;

if (NNError=NO_ERROR) then
begin
for loop1:=1 to EntryCount do
if Pos('Microsoft',NetRes[0].lpProvider)=1 then
begin
Result:=TRUE;
Break;
end;
end
else
Break;
end;
WNetCloseEnum(hEnum); // close enum
end;
except
on exception do
if DEBUG then ShowMessage('Network Neighborhood Detection
Failed.');
end;
end;

In article <35e28912...@news.bernoise.ch>,
marc.s...@no.spam.please.ch says...


> Is there an easy way in Delphi (some Win32 API call) to check whether
> or not I'm on a LAN? I searched on developers.href.com, but couldn't
> find any helpful messages.......
>
> I found various things, like checking for your username, or retrieving
> logon information from the registry, but they can all fail if you

> consider a dockable notebook: there might be information available in


> the registry that is needed *IF* the notebook is on a LAN, but how can
> I check if it really is connected or not?
>

> Any hints are most welcome!
>
> Marc
>
> --------------------------------------------------------------------------
> Marc Scheuner Berner Versicherungen, Dept. ISV
> May the Source be With You Laupenstrasse 27
> marc.s...@berner.ch CH-3001 BERNE, Switzerland
> --------------------------------------------------------------------------
>

--
For great networking utilities visit
WiredRed Software -

http://www.wiredred.com

0 нових порука