LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

GetCurrentUser gives old user name on XP

I am developing a GUI to be used for an automated test platform.  We are using LabWindows 8.1.1 on Windows XP.  The computer we are using will have two separate Windows accounts for the developers and testers, with the program having different permissions for each.
 
I originally created the developers account as "SDP PLATE" and I was using GetCurrentUser() to detect the user ID and set the permissions accordingly.  I am now trying to change the name of this account to "Admin" through the Windows control panel.  However, GetCurrentUser() still reads the user ID as the old name.
 
Is there something else I need to change to get this to work, perhaps in the Windows registry?
 
I have also tried using the Windows SDK GetUserName() function, which I can't get to work at all.  It always returns an error code of 122 (insufficient buffer size), no matter how large I make the string buffer.
0 Kudos
Message 1 of 2
(3,538 Views)
Rich,

It looks like changing the name in control panel only changes the display name, not the actual user name behind the scene, nor update the registry files, which are what the GetCurrentUser() function looks at. You may take a look at this web site for how to change the actual user name.

Song D
Regards,

Song Du
Systems Software
National Instruments R&D
0 Kudos
Message 2 of 2
(3,495 Views)