Reputation: 111
In Windows 10 , user can use Microsoft Account to login , i know how to get offline user name but online user name can't.
How to get correct user name while user uses the Microsoft Account to login windows by C++ ?
Thanks!!
Upvotes: 0
Views: 558
Reputation: 11
You can get "internet principal name" from NetUserGetInfo(...) function. with level 24.
pseudo code is :
if(NetUserGetInfo(NULL, sAccountName, 24, (LPBYTE*)&pInfo24) == NERR_Success)
{
sPrincipalName = pInfo24->usri24_internet_principal_name;
}
Upvotes: 1