我有一个遗留程序,用于测试终端会话以查看特定用户是否已登录,如果该用户未登录则发送邮件。使用{{1}调用已完成编码如下
WTSQuerySessionInformation
上述程序在Windows 2003上正常运行,但它未在Windows 7 / Windows 2008 R2上运行。当我尝试调试代码时,它运行正常,但是当我按计划任务部署程序时,它没有运行,函数 If WTSQuerySessionInformationW(ptrOpenedServer, active_session, WTS_INFO_CLASS.WTSUserName, str, returned) = True Then
ClientInfo.WTSUserName = str
riter.AppendLine("feeded UserName" + str + " Active sessin: " + active_session.ToString() + " returned :" + returned.ToString())
Else
riter.AppendLine("Failed in feeding UserName")
End If
'Get StationName of this TS session
If WTSQuerySessionInformationW(ptrOpenedServer, active_session, WTS_INFO_CLASS.WTSWinStationName, str, returned) = True Then
ClientInfo.WTSStationName = str
riter.AppendLine("feeded StationName" + str + " Active sessin: " + active_session.ToString() + " returned :" + returned.ToString())
Else
riter.AppendLine("Failed in feeding StationName")
End If
'Get Domain Name of this TS session
If WTSQuerySessionInformationW(ptrOpenedServer, active_session, WTS_INFO_CLASS.WTSDomainName, str, returned) = True Then
ClientInfo.WTSDomainName = str
riter.AppendLine("feeded Domain" + str + " Active sessin: " + active_session.ToString() + " returned :" + returned.ToString())
Else
riter.AppendLine("Failed in feeding Domain")
End If
正在为用户名等提供空的详细信息。
所以想知道我是否错过了Win 7/2008 R2的任何内容。