Retrieving a User Name (Windows Embedded CE 6.0)
1/6/2010
An application can use the WNetGetUser function to retrieve the name of the user associated with a connected network resource. The following code example shows how WNetGetUser function retrieves a user name based on a device name called MyDevice.
TCHAR szUserName[80];
DWORD dwResult,
cchBuffer = 80;
dwResult = WNetGetUser (TEXT("MyDevice"), szUserName, &cchBuffer);
if (dwResult == ERROR_SUCCESS)
MessageBox (hwnd, szUserName, TEXT("Info"), MB_OK);
else
{
ErrorHandler (hwnd, dwResult, TEXT("WNetGetUser"));
return FALSE;
}
See Also
Concepts
Retrieving Network Data
Windows Networking API/Redirector Application Development
Managing Network Connections with WNet