搬家第22天-Cicode实验代码7-获取当前登录用户名
有时候我们需要知道当前登录的用户名字是什么,可以使用这样的方法。
新建内部变量username表示当前用户名,string类型。在页面上放置一个数字控件,字符串类型,连接username变量。在页面属性的事件“当页面显示时”添加以下代码:
IF UserInfo(0) = "1" THEN
username = UserInfo(1);
else
username=""
END
保存编译运行,登录不同的用户时,就能显示出当前的用户名是什么了。
userinfo有一个参数,含义如下:
0 - Flag to indicate whether any user other than a view-only user is logged in
是否有用户登录,1为有用户登录
1 - The login name of the user
当前用户名
2 - The full name of the user
当前用户全名
3 - The time the user logged in
用户登录时间
4 - The time the user entered the last command
用户最近操作时间
5 - The number of commands entered by the user
用户最近操作数量?
6 - The type of login:
登录类型
- "0" indicates that the current user is a view-only user.
只能浏览的用户
- "1"indicates there is Vijeo Citect or Windows non-default user explicitly logged in.
- "2" indicates the logged on user is a Vijeo Citect default user (control client auto login Vijeo Citect user).
- "3" indicates the logged on user is a Windows default user (control client auto login windows user).

浙公网安备 33010602011771号