Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Check if PC is Connected to the Network

Status
Not open for further replies.

orna

Programmer
Apr 2, 2002
314
IL
Hi

I found that API function but can't get it to work.

NetUserGetInfo(environ("logonserver"), Environ("username"), 0, 0)

What am i doing wrong?
Thank for any help
 
1. Is that a typo, or are you calling different functions environ and Environ?

2. What are the actual values returned by environ/Environ?

3. You need to supply a pointer to a pointer to a USER_INFO_0 structure in the 4th argument instead of a null pointer.

LPUSER_INFO_0 buf = NULL;

NetUserGetInfo(Environ("logonserver"), Environ("username"), 0, (LPBYTE *) &buf)

/* Do stuff with buf */

NetApiBufferFree(buf);
 
Forgot to mention its VBA and i'm a rookie
Environ("username") returns the user logon to Net
Environ("logonserver") returns the server name
You might explain a bit more about the buf?

TX
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top