Get the name of the computer and current user.

Get the name of the computer and current user.

GetComputerName,GetUserName

See version :

Pas de dépendances

Download :

#include <windows.h>
#include <tchar.h>
#include <lmcons.h>

int main()
{
    int taillecomptername;
    int tailleusername;
    TCHAR computername[UNLEN+1];
    TCHAR username[UNLEN+1];
    taillecomptername = UNLEN+1;
    tailleusername = UNLEN+1;
    GetComputerName(computername,&taillecomptername);
    GetUserName (username,&tailleusername);
    _tprintf(_T("nom ordi : %s ; taille = %d\n"),computername,taillecomptername);
    _tprintf(_T("nom utilisateur : %s ; taille = %d\n"),username,tailleusername);
    return 0;
}



Explanations

	No explanations yet.