LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to get full user name by windows login user name?

Solved!
Go to solution

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.

0 Kudos
Message 1 of 6
(6,177 Views)
0 Kudos
Message 2 of 6
(6,174 Views)

It's only user name, but I need full user name. It may be different from user name.

 

0 Kudos
Message 3 of 6
(6,167 Views)

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).


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 4 of 6
(6,150 Views)
Solution
Accepted by topic author shda1

Here this can help : https://decibel.ni.com/content/docs/DOC-24358

Thanks
uday
Message 5 of 6
(6,141 Views)

It works, but after the completion of vi LabVIEW crashed. Exception: Access violation (0xC0000005) at EIP=0x04E9334F. OS Windows 7 64. LabVIEW2014 (32-bit).

0 Kudos
Message 6 of 6
(6,108 Views)