Retrieving the User Name
To retrieve the name of the user associated either with a local device
connected to a network resource or with the name of a network, an application can call
the
WNetGetUser function. The following example uses the device name to retrieve the name of
the user.
CHAR szUserName[80];
DWORD dwResult, cchBuff = 80;
dwResult = WNetGetUser("z:",
(LPSTR) szUserName,
&cchBuff);
if(dwResult == NO_ERROR)
TextOut(hdc, 10, 10,
(LPSTR) szUserName,
lstrlen((LPSTR) szUserName));
else {
// An application-defined error handler is demonstrated in the
// section titled "Retrieving Network Errors."
NetErrorHandler(hwnd, dwResult, (LPSTR)"WNetGetUser");
return FALSE;
}
- Software for developers
-
Delphi Components
.Net Components
Software for Android Developers
- More information resources
-
MegaDetailed.Net
Unix Manual Pages
Delphi Examples
- Databases for Amazon shops developers
-
Amazon Categories Database
Browse Nodes Database