[WMI实例]在网络连接断开时通知用户
strComputer := "." objWMIService := ComObjGet("winmgmts:\\" strComputer "\root\wmi") colMonitoredEvents := objWMIService.ExecNotificationQuery("Select * from MSNdis_StatusMediaDisconnect") Loop { strLatestEvent := colMonitoredEvents.NextEvent MsgBox, % "有一个网络连接断开了: " strLatestEvent.InstanceName } return
strComputer := "." objWMIService := ComObjGet("winmgmts:\\" strComputer "\root\wmi") colMonitoredEvents := objWMIService.ExecNotificationQuery("Select * from MSNdis_StatusMediaConnect") Loop { strLatestEvent := colMonitoredEvents.NextEvent MsgBox, % "有一个网络连接建立了: " strLatestEvent.InstanceName } return