Gehe zu deutscher Webseite

Projects & downloads

You are here:
Projects & downloadsViaThinkSoft SimpleLogEvent

Project description:

ViaThinkSoftSimpleLogEvent offers a COM interface for easily logging things into the Windows Event Log.

Using a COM interface enables some applications which cannot call arbitary DLL functions (like PHP) to write to the Event Log.

Additionally, ViaThinkSoftSimpleLogEvent registeres a "Log Event Provider" which will prevent the message "The description for Event ID ... from source ... cannot be found" that would show up if you would call the WinAPI function "ReportEvent" without MessageTable/Provider.


Example usage with VBScript

Dim objMyObject

set objMyObject = CreateObject("ViaThinkSoftSimpleLogEvent.ViaThinkSoftSimpleEventLog")

const LOGEVENT_MSG_SUCCESS       = 0
const LOGEVENT_MSG_INFORMATIONAL = 1
const LOGEVENT_MSG_WARNING       = 2
const LOGEVENT_MSG_ERROR         = 3

objMyObject.LogEvent "MySourceName", LOGEVENT_MSG_WARNING, "This is a test warning written by VBS"

Example usage with PHP

define('CLASS_ViaThinkSoftSimpleEventLog', '{E4270053-A217-498C-B395-9EF33187E8C2}');

define('LOGEVENT_MSG_SUCCESS',       0);
define('LOGEVENT_MSG_INFORMATIONAL', 1);
define('LOGEVENT_MSG_WARNING',       2);
define('LOGEVENT_MSG_ERROR',         3);

$x = new COM(CLASS_ViaThinkSoftSimpleEventLog);
$x->LogEvent('MySourceName', LOGEVENT_MSG_WARNING, 'This is a test warning written by PHP');

Example usage with Delphi

uses
  ActiveX,
  ViaThinkSoftSimpleLogEvent_TLB;

procedure LogTest;
var
  x: IViaThinkSoftSimpleEventLog;
begin
  CoInitialize(nil); // needs to be called only once
  x := CoViaThinkSoftSimpleEventLog.Create;
  x.LogEvent('MySourceName', ViaThinkSoftSimpleLogEvent_TLB.Warning, 'This is a test warning written by Delphi');
  x := nil;
end;
Daniel Marschall
ViaThinkSoft Co-Founder

Screenshots of the projekt

  Example of created log event