線上訂房服務-台灣趴趴狗聯合訂房中心
發文 回覆 瀏覽次數:1004
推到 Plurk!
推到 Facebook!

如何取得目前登入windows的使用者名稱?

答題得分者是:zilch
nlj859
資深會員


發表:139
回覆:375
積分:322
註冊:2004-03-20

發送簡訊給我
#1 引用回覆 回覆 發表時間:2004-08-13 22:47:11 IP:219.80.xxx.xxx 未訂閱
有現成的API可用嗎? 請問該如何撰寫? 謝謝.
zilch
中階會員


發表:5
回覆:87
積分:78
註冊:2002-09-24

發送簡訊給我
#2 引用回覆 回覆 發表時間:2004-08-13 23:22:20 IP:218.167.xxx.xxx 未訂閱
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;
系統時間:2024-05-09 13:53:46
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!