// Use WinUser.nui // User_Windows_User_Name function Use Windows.pkg Use Dll.pkg // External_Function User_WNetGetUser "WNetGetUserA" mpr.dll pointer lpName pointer lpUserName string lpnLength returns DWord External_Function User_WNetGetUser "WNetGetUserA" mpr.dll pointer lpName pointer lpUserName pointer lpLength returns DWord Function User_Windows_User_Name global Returns String String sName sLength Pointer lpName_Addr lpLength_Addr Integer iRetval Movestr (Repeat (Character (0), 255)) To sName GetAddress Of sName To lpName_Addr // ok Movestr (DwordToBytes (255)) To sLength GetAddress Of sLength To lpLength_Addr // ok Moveint (User_WNetGetUser (0, lpName_Addr, lpLength_Addr)) To iRetval If iRetval Eq 0 Function_Return (CString (sName)) Else Function_Return "User Unknown" End_Function // Network_User_Name