Retrieving a User Name (Windows CE 5.0)

Send Feedback

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

Windows Networking API/Redirector Application Development | Managing Network Connections with WNet | Retrieving Network Data

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.