直接修改Info类的StartupPost方法,因为我们修改比较复杂,以下我就直接引用junevoful的代码来做范例。
void startupPost()
{
int counter;
int num = 0;
int maxSessions = Info::licensedUsersTotal();
xSession session;
UserInfo userInfo;
UserId currentUserId;
;
currentUserId = curuserid();
for(counter = 1; counter < maxSessions;counter++ )
{
session = new xSession(counter, true);
if(session && session.userId())
{
select firstOnly userInfo
where userInfo.id == session.userId();
if (userInfo && (currentUserId == session.userId()))
{
num++ ;
}
}
}
if (num > 1)
{
box::info("此用户ID已经登陆,请退出。")
{
infolog.shutDown(true);
}
}
}