如何取得局域网用户的登陆名?

aomeng 2222 研发部门经理  2001-07-11 09:06:35
在一个NT局域网中,当一个用户从一个工作站上访问另一个工作站是,如何取得这个用户的登陆帐号名。

谢谢!
...全文
86 点赞 收藏 7
写回复
7 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
hssfox 2001-11-20
关注
回复
Rain_Z001 2001-08-14
Windows 2000 and later: Use the GetUserNameEx function to retrieve the user name in a specified format. Additional information is provided by the interface.

BOOL GetUserName(
LPTSTR lpBuffer, // name buffer
LPDWORD nSize // size of name buffer
);
Parameters
lpBuffer
[out] Pointer 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. A buffer size of (UNLEN + 1) characters will hold the maximum length user name including the terminating null character. UNLEN is defined in Lmcons.h.
nSize
[in/out] On input, specifies the maximum size, in TCHARs, of the buffer specified by the lpBuffer parameter. On output, receives the number of characters copied to the buffer.
If the buffer is not large enough, the function fails and nSize receives the required buffer size, in TCHARs, including the terminating null character.

Return Values
If the function succeeds, the return value is a nonzero value, and the variable pointed to by nSize contains the number of TCHARs copied to the buffer specified by lpBuffer, including the terminating null character.

If the function fails, the return value is zero. To get extended error information, call .
MSDN上的!你可以写个com试试
回复
aomeng 2001-08-14
echo gethostbyaddr(getenv('REMOTE_ADDR')
//getenv("REMOTE_ADDR") 得到浏览者的IP地址, gethostbyaddr($ip) 根据IP得到主机名字。
这是我变通的解决方法。
回复
aomeng 2001-07-13
win2k professional!
是不是只有管理员的权限才可以.
回复
kahntang 2001-07-12
你用的是什么系统啊!
回复
gop 2001-07-12
D:>nbtstat -a IPAddr
查看一下那个用户所在的机器的当前用户名
回复
aomeng 2001-07-12
给点提示好不好?
回复
相关推荐
发帖
基础编程
创建于2007-09-28

2.1w+

社区成员

从PHP安装配置,PHP入门,PHP基础到PHP应用
申请成为版主
帖子事件
创建了帖子
2001-07-11 09:06
社区公告
暂无公告