Ooops, forgot to increment index. I did too quick a job extracting the
example from my code. The point is to start index at 0 and increment until
NetLib tells me it's too big.

On 3/19/07, Luca Bertoncello <[EMAIL PROTECTED]> wrote:
>
> "Jeff Loucks" <[EMAIL PROTECTED]> schrieb:
>
> > You get libRefNum from SysLibFind("Net.lib", &libRefNum). Then, you
> iterate
> > through all the interfaces, skipping the loopback interface. When you
> find
> > one that reports up, then you have a network. It may not be the network
> you
> > want or can use, but you know something is up. Here's some code:
> >
> >
> > Boolean IsAnyNetworkUp(UInt16 libRefNum)
> >  {
> >  UInt16 instance,size,index = 0;
> >  UInt32 creator;
> >  UInt8 value;
> >  Err err;
> >
> >  while (1)
> >   {
> >   err = NetLibIFGet(libRefNum,index,&creator,&instance);
> >   if (err == netErrInvalidInterface)
> >    return false;
> >   if (err == errNone && creator != netIFCreatorLoop)
> >    {
> >    size = sizeof(value);
> >    if
> >
> (NetLibIFSettingGet(libRefNum,creator,instance,netIFSettingUp,&value,&size)
> > == errNone &&
> >     value != 0)
> >     return true;
> >    }
> >   }
> >  }
>
> It seems, that your code go in an loop without end...
> Any suggestion?
>
> I call your function so:
>
> if(SysLibFind("Net.lib", &AppNetRefnum) == 0)
> {
> if(IsAnyNetworkUp(AppNetRefnum))
>    StrCopy(W, "T");
> else
>    StrCopy(W, "F");
> }
> else
> StrCopy(W, "0");
>
> Is if false?
>
> Thanks
> Luca Bertoncello
> ([EMAIL PROTECTED])
>
> --
> For information on using the ACCESS Developer Forums, or to unsubscribe,
> please see http://www.access-company.com/developers/forums/
>



-- 
[Jeff Loucks]

-- 
For information on using the ACCESS Developer Forums, or to unsubscribe, please 
see http://www.access-company.com/developers/forums/

Reply via email to