Platforms to show: All Mac Windows Linux Cross-Platform
/Win/WMI/WMI Process Creation Events via Remote
Required plugins for this example: MBS Win Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Win/WMI/WMI Process Creation Events via Remote
This example is the version from Fri, 12th Aug 2021.
Project "WMI Process Creation Events via Remote.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
Sub Constructor()
// required for Windows 8.1 or later
Call WindowsWMIMBS.InitSecurity(False)
End Sub
End Class
Class MainWindow Inherits Window
Control List Inherits Listbox
ControlInstance List Inherits Listbox
End Control
Control Timer1 Inherits Timer
ControlInstance Timer1 Inherits Timer
EventHandler Sub Action()
dim found as Boolean = false
while w.NextItem
found = true
List.AddRow "got event "+str(Ticks)
dim s() as string = w.GetNames
dim o as WMIObjectMBS = w.GetPropertyObject("TargetInstance")
if o<>Nil then
List.AddRow "Type: "+o.GetPropertyString("__CLASS")
List.AddRow "Name: "+o.GetPropertyString("Name")
List.AddRow "Path: "+o.GetPropertyString("ExecutablePath")
else
List.AddRow "o = nil"
end if
wend
if found then
me.Period = 100
else
me.Period = 1000
end if
End EventHandler
End Control
EventHandler Sub Open()
dim query as string
if false = WindowsWMIMBS.InitSecurity(true) then
MsgBox "InitSecurity failed."
end if
query = "SELECT * FROM __InstanceCreationEvent WITHIN 1 WHERE TargetInstance ISA 'Win32_Process'"
w = new WindowsWMIMBS
const password = "xxx"
// please change name, password and IP
if w.InitAuthentication("Christian", "", password) then
if not w.ConnectServer("\\192.168.2.43\root\cimv2", "Christian", password) then
MsgBox "Failed to connect."
elseif not w.ExecNotificationQueryAsync("WQL", query) then
MsgBox "Failed to run query."
else
// ok
timer1.Mode = 2
end if
else
MsgBox "Failed."
end if
End EventHandler
Property w As WindowsWMIMBS
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&Ablage"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Bearbeiten"
MenuItem EditUndo = "&Rückgängig"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "&Ausschneiden"
MenuItem EditCopy = "&Kopieren"
MenuItem EditPaste = "&Einfügen"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "&Alles auswählen"
End MenuBar
End Project
See also:
The items on this page are in the following plugins: MBS Win Plugin.