//*************************************************************** // From the book "Win32 System Services: The Heart of Windows 98 // and Windows 2000" // by Marshall Brain // Published by Prentice Hall // // Copyright 1995, by Prentice Hall. // // This code gets the name of the user on the local or a remote // machine. //*************************************************************** // drvgetu.cpp #include #include void main() { DWORD result; char name[256]; DWORD bufferSize = 256; result = WNetGetUser(0, name, &bufferSize); if (result == NO_ERROR) cout << name << endl; else cout << "Error: " << result; }