Xojo Conferences

Platforms to show: All Mac Windows Linux Cross-Platform

/Win/WMI/WMI Recent Windows Events Web
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 Tue, 22th Jun 2015.
Project "WMI Recent Windows Events Web.rbp"
Class App Inherits WebApplication
EventHandler Sub Open() // 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 Action() 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.Cell(List.LastIndex,1)=str(w.GetPropertyInteger("EventCode")) List.Cell(List.LastIndex,2)=w.GetPropertyString("Message") end if end if next else MsgBox "NextItem: fail"+EndOfLine+"Lasterror: "+str(w.Lasterror) end if else MsgBox "query: fail"+EndOfLine+"Lasterror: "+str(w.Lasterror) end if else MsgBox "ConnectServer: fail"+EndOfLine+"Lasterror: "+str(w.Lasterror) end if else MsgBox "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
End Project

See also:

Feedback, Comments & Corrections

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

MBS FileMaker Plugins