Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
unit u_eventlog;
interface
uses SysUtils, Windows;
type
TEventLog = Class
public
procedure Add(EvtType : integer; EvtMsg : string);
end;
var
NTEventLog : TEventlog;
implementation
{$R U_EVENTLOG.RES} // include message resource
procedure TEventlog.Add(EvtType : integer; EvtMsg : string);
var Log : THandle;
Category,EventID : Integer;
Data,DataSize : Integer;
P : PChar;
begin
Log:=OpenEventLog(nil,STR_NAME_APPLICATION);
if (Log <> 0) then
begin
Category:=0; // no specific category
EventID := 1000; // only one event defined, message resource has message 1000 included
Data := 0; // no data
DataSize := 0; // thus size is 0
P:=Pointer(EvtMsg);
if not ReportEvent(Log,EvtType,Category,EventID,nil,1,DataSize,@P,@Data) then
// report any error here to your debugger
else
CloseEventLog(Log);
end
else Debug.Output('Could not open Windows Application Event log',LVL_NORM);
end;
initialization
try
NTEventLog:=TEventLog.Create;
finally
end;
finalization
try
if Assigned(NTEventLog) then FreeAndNil(NTEventLog);
finally
end;
end.