Re: Win32Lib getUserName() problem
- Posted by jimcbrown (admin) Dec 16, 2009
- 1385 views
I have recently written a program which uses the Win32Lib getUserName() routine. This works fine, but if the user changes his name in Windows, the getUsername() routine still gets his original name. Now I guess that Windows - XP SP3 in my case - creates the initial user group with the original name, but then just hangs a string on it with the name. Initially the name created, but after that whatever the user has called himself.
Is there any way that anyone knows whereby I can get the current user's name, rather than the name the current account was created with?
Thanks in advance...
Andy
Eh? How's he changing his name?
Does %USERNAME% or %USER% get updated after the change? If so, you can just use getenv() rather than trying to find a W32API function to detect this.