For "b" I use for few years
GPLIB library but this is a commercial one. If you want a "free one" and don't mind use RUN command and search your data in a text file you can RUN NLIST USER /A and then extract your "active" users information.
For "a" I'm not pretty shure but this MSDN articles may be useful:
190741 - HOWTO: Get User Information Using ADSI and
192766 - SAMPLE: ADSIBrow.exe Browses Active Directory w/ Visual FoxPro>Hi All
>
>I am looking for a way to enumerate users who are currently logged onto a LAN. I found a Win API that enumerate all user accounts, but cannot find anything that will tell me who is actually logged on:
>a) to a microsoft network
>b) to a novell network
>
>Item "a" is somewhat more important that "b".
>
>Your ideas would be most welcome.
>
>Thanks in advance.
>Don Lowrey
>
>PS: The function has to be ran from a workstation.