LogEvent Method

 

Description

 

Adds an event entry to a log file.

 

PowerBASIC Syntax

 

METHOD LogEvent ( _

BYREF vType AS VARIANT, _

BYVAL bstrMessage AS STRING, _

OPTIONAL BYVAL bstrTarget AS STRING _

) AS INTEGER

 

Arguments

 

vType

VARIANT. Integer value representing the event type.

bstrMessage

BSTR. String value containing the log entry text.

bstrTarget

Optional. BSTR. String value indicating the name of the computer system where the event log is stored (the default is the local computer system). Applies to Windows NT/2000 only.

 

Remarks

 

The LogEvent method returns a Boolean value (true if the event is logged successfully, otherwise false). In Windows NT/2000, events are logged in the Windows NT Event Log. In Windows 9x/Me, events are logged in WSH.log (located in the Windows directory). There are six event types.

 

Type

Value

0

SUCCESS

1

ERROR

2

WARNING

4

INFORMATION

8

AUDIT_SUCCESS

16

AUDIT_FAILURE

 

Example [PowerBASIC]

 

#INCLUDE "WSHOM.INC"

 

DIM pWsh AS IWshShell2

DIM vType AS VARIANT

 

vType = 0 AS LONG

pWsh = NEWCOM "WScript.Shell"

pWsh.LogEvent vType, UCODE$("Logon Script Completed Successfully")

 

Valid XHTML 1.0 Transitional