char userName[MAX_PATH],cName[MAX_PATH],;
CString sUsername,cName;
DWORD size=MAX_PATH;
::GetUserName(userName,&size);
sUsername.Format("%s",userName);
MessageBox("用户名为:"+sUsername);
char userName[MAX_PATH];
CString sUsername,cName;
DWORD size=MAX_PATH;
::GetComputerName(userName,&size);
sUsername.Format("%s",userName);
MessageBox("计算机名为:"+sUsername);
//主要是函数 GetUserName,GetComputerName
[VC]获取当前用户名,计算机名
最新推荐文章于 2022-07-12 14:44:42 发布