扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
作者:maqiaos_cn 来源:vb新世纪 2007年10月14日
关键字:
Option Explicit Dim Locator As SWbemLocator Dim Services As SWbemServices Dim WithEvents StatusSink As SWbemSink Private Sub KillEvents() StatusSink.Cancel Set StatusSink = Nothing End Sub Private Sub Form_Load() Dim Query As String Set StatusSink = New SWbemSink Set Locator = CreateObject("WbemScripting.SWbemLocator") Set Services = Locator.ConnectServer() Query = "SELECT * FROM __InstanceCreationEvent " Query = Query + "WITHIN 1 " Query = Query + "WHERE TargetInstance ISA ‘Win32_Process‘" Services.ExecNotificationQueryAsync StatusSink, Query End Sub Private Sub StatusSink_OnObjectReady(ByVal StatusEvent As SWbemObject, _ ByVal EventContext As SWbemNamedValueSet) Dim arr Dim strQue As String Dim i As Integer List1.Clear arr = Split(StatusEvent.GetObjectText_, Chr(10)) For i = LBound(arr) To UBound(arr) List1.AddItem arr(i) Next i End Sub Private Sub StatusSink_OnCompleted(ByVal HResult As WbemErrorEnum, _ ByVal ErrorObject As SWbemObject, _ ByVal EventContext As SWbemNamedValueSet) If HResult <> wbemErrCallCancelled Then ‘错误处理 End If End Sub |
<html> <head> <object ID="mysink" CLASSID= "CLSID:75718C9A-F029-11d1-A1AC-00C04FB6C223"></object> </head> <SCRIPT> function window.onload() { var locator = new ActiveXObject ("WbemScripting.SWbemLocator"); var service = locator.ConnectServer(); szQuery = "SELECT * FROM __InstanceCreationEvent "; szQuery += "WITHIN 1 "; szQuery += "WHERE TargetInstance ISA ‘Win32_Process‘"; service.ExecNotificationQueryAsync(mysink,szQuery); } </SCRIPT> <script FOR="mysink" EVENT="OnObjectReady(obj, objAsyncContext)"> document.all.info.innerHTML += obj.TargetInstance.Name + "<br>"; </script> <body> <span ID="info"></span> </body> </html> |
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。
现场直击|2021世界人工智能大会
直击5G创新地带,就在2021MWC上海
5G已至 转型当时——服务提供商如何把握转型的绝佳时机
寻找自己的Flag
华为开发者大会2020(Cloud)- 科技行者