如何取得目前登入windows的使用者名稱? |
答題得分者是:zilch
|
nlj859
資深會員 發表:139 回覆:375 積分:322 註冊:2004-03-20 發送簡訊給我 |
|
zilch
中階會員 發表:5 回覆:87 積分:78 註冊:2002-09-24 發送簡訊給我 |
BOOL GetUserName( LPTSTR lpBuffer, // address of name buffer
LPDWORD nSize // address of size of name buffer
); Parameters lpBuffer Points to the buffer to receive the null-terminated string containing the user's logon name. If this buffer is not large enough to contain the entire user name, the function fails. nSize Pointer to a DWORD that, on input, specifies the maximum size, in characters, of the buffer specified by the lpBuffer parameter. If this buffer is not large enough to contain the entire user name, the function fails. If the function succeeds, it will place the number of characters copied to the buffer into the DWORD that nSize points to. char username[MAX_COMPUTERNAME_LENGTH 1];
DWORD size = MAX_COMPUTERNAME_LENGTH 1;
if(GetUserName(username,&size))
Label1->Caption = username;
|
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |