Sub uselist()
Dim conn As New ADODB.Connection
Dim rst As ADODB.Recordset
On Error GoTo except:
conn.Open "file name=I:\系統\cnn.udl", , "wuzwabc9abz" '打開目的數據庫連接, 此為利用UDL文件打開﹐也開用正常的方式﹐提供connectionstring
Set rst = conn.OpenSchema(adSchemaProviderSpecific, , "{947bb102-5d43-11d1-bdbf-00c04fb92675}")
Do Until rst.EOF
userlist = userlist & "net send " & rst!COMPUTER_NAME & content & vbCrLf , rst!LOGIN_NAME, rst!CONNECTED, rst!SUSPECT_STATE
rst.MoveNext
Loop
Exit sub
except:
MsgBox Err.Description
end sub
可將此放到一個Timer 事件下﹐并將查詢結果整理后存到一個表中。關鍵技朮數與上條記錄做比較﹐就可知用戶登陸﹐登出情況
[此贴子已经被作者于2005-8-12 9:00:34编辑过]
|