Platforms to show: All Mac Windows Linux Cross-Platform

/Win/WMI/WMI Recent Windows Events Web


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 Recent Windows Events Web

This example is the version from Sun, 5th Nov 2022.

Project "WMI Recent Windows Events Web.xojo_binary_project"
Class App Inherits WebApplication
EventHandler Sub Opening(args() as String) // required for Windows 8.1 Call WindowsWMIMBS.InitSecurity(False) End EventHandler
End Class
Class Session Inherits WebSession
Const ErrorDialogCancel = "Do Not Send"
Const ErrorDialogMessage = "This application has encountered an error and cannot continue."
Const ErrorDialogQuestion = "Please describe what you were doing right before the error occurred:"
Const ErrorDialogSubmit = "Send"
Const ErrorThankYou = "Thank You"
Const ErrorThankYouMessage = "Your feedback helps us make improvements."
Const NoJavascriptInstructions = "To turn Javascript on, please refer to your browser settings window."
Const NoJavascriptMessage = "Javascript must be enabled to access this page."
End Class
Class WebPage1 Inherits WebPage
Control Button1 Inherits WebButton
ControlInstance Button1 Inherits WebButton
EventHandler Sub Pressed() if TargetWin32 then // init and connect w=new WindowsWMIMBS if w.ConnectServer("root\cimv2") then // query number of records if w.query("WQL","Select * from Win32_NTEventLogFile Where LogFileName = 'Application'") then if w.NextItem then dim NumberOfRecords as integer = w.GetPropertyInteger("NumberOfRecords") dim last10 as integer = 0 if NumberOfRecords > 10 then last10 = NumberOfRecords - 10 // now get the newest 10 for i as integer = last10 to NumberOfRecords-1 if w.Query("WQL","Select * from Win32_NTLogEvent Where LogFile = 'Application' AND RecordNumber =" +str(i)) then if w.NextItem then list.AddRow w.GetPropertyString("ComputerName") List.CellTextAt(List.LastAddedRowIndex,1) = Str(w.GetPropertyInteger("EventCode")) List.CellTextAt(List.LastAddedRowIndex,2) = w.GetPropertyString("Message") end if end if next else MessageBox "NextItem: fail"+EndOfLine+"Lasterror: "+Str(w.Lasterror) end if else MessageBox "query: fail"+EndOfLine+"Lasterror: "+Str(w.Lasterror) end if else MessageBox "ConnectServer: fail"+EndOfLine+"Lasterror: "+Str(w.Lasterror) end if else MessageBox "This example is for Windows only." end if End EventHandler
End Control
Control List Inherits WebListBox
ControlInstance List Inherits WebListBox
End Control
Property w As WindowsWMIMBS
End Class
Sign
End Sign
End Project

See also:

The items on this page are in the following plugins: MBS Win Plugin.


The biggest plugin in space...