08-03-2016 10:32 AM
Hello.
I need to determine full user name by Windows login user name. Where are many ways to determine login user name. For example application property node App.UserName or %username% variable in cmd. But I found only one way to determine full user name by logged in user name - "net user" command in cmd. This way is very slow and requires huge code (i must get logged in user name, check if user logged local or domain, create command "net user", find in output full user name).
Is there a simpler way without using cmd?
PS Full user name appears in Windows login screen and in Start menu and may be different from user name.
Solved! Go to Solution.
08-03-2016 10:38 AM
Checked this: http://digital.ni.com/public.nsf/allkb/03F7257B337CC63E8625754D0082FDE4
08-03-2016 10:47 AM
It's only user name, but I need full user name. It may be different from user name.
08-03-2016 11:10 AM
A call to WINAPI should do it: https://msdn.microsoft.com/en-us/library/windows/desktop/ms724435(v=vs.85).aspx
The EXTENDED_NAME_FORMAT parameter defines the format of the data to return:
NameDisplay
A "friendly" display name (for example, Jeff Smith). The display name is not necessarily the defining relative distinguished name (RDN).
08-03-2016 11:28 AM
Here this can help : https://decibel.ni.com/content/docs/DOC-24358
08-03-2016 11:16 PM - edited 08-03-2016 11:33 PM
It works, but after the completion of vi LabVIEW crashed. Exception: Access violation (0xC0000005) at EIP=0x04E9334F. OS Windows 7 64. LabVIEW2014 (32-bit).