|Products Purchase Publishing Articles Support Company Contact|
support > Product FAQ > Event Log Toolkit
Event Log Toolkit
NT Service Toolkit
Event Log Toolkit Support
Frequently Asked Questions
1. Does the NT Service Toolkit support reporting events that are supplied by the Event Log Toolkit?
Yes, version 1.1 of the NT Service Toolkit includes a new ReportEvent2 function that you can call to report events that are compatible with the Event Source file created with the Event Log Toolkit. You can run the NT Service Toolkit Run Time Update utility to retrieve the latest .svt and dwntserv.tlb files, add the changes to your VB project, then remake your Service EXE.
A sample snippet is shown below:
Public Const EVENTAPPNAME = "Beeper" Private Function IdwEasyService_OnStart(ByVal _ ControlObject As EASYSERVLib.IdwServiceCtl) As Long Dim msgid As Long
'You can build the eventid by combining the facility
msgid = &HFFF * &H10000 ' facility = Application msgid = msgid Or 1 ' message event number = 1 msgid = msgid Or &H40000000 ' severity = info ' use &H80000000 for warning ' use &HC0000000 for error ' use 0 for success ControlObject.ReportEvent2 EVENTAPPNAME, _ svcEventlogInformation, CategoryNumber, _ EventID End Function
2. Can I use the Event Log Toolkit with .NET?
You can use the Event Source file generated by the Event Log Toolkit with the .NET EventLog object, but you need to make some changes to the format of the Event Source file. Also, not all of the Event Log functionality is supported by the .NET EventLog object.
Run the Event Log Toolkit File Update utility to download the DotNetReadme.txt and DotNetUpdate.zip files or contact Desaware if you have a firewall or proxy server that may prevent the Event Log Toolkit Update utility from working.
3. Why does the Event Viewer provided take so long to display all of the events?
Thesample Event Viewer provided demonstrates using the different functions provided in the dwEventLog class. But it is not optimized for scanning through the entire Event Log and retrieving all of the information from it. This is because the Event Viewer calls the ReadEvent function for each event entry. The ReadEvent function opens the Event Log file, searches for the event entry from the beginning of the file, reads the event, then closes the Event Log file. A more efficient method would be to open the Event Log file once, read through all of the entries sequentially retrieving the information for each entry, then close the Event Log file.
4. When I call the ReportEvent method of the dwEventLog class, I get a subscript out of range error.
The error occurs on the line:
StringCount = UBound(MergeStrings) - LBound(MergeStrings)
There was a bug with the dwEventLog class's ReportEvent where if the MergeStringsArray parameter was not specified, it would not be initialized. In the ReportEvent function, change the following code from:
If Not IsMissing(MergeStringsArray) Then If VarType(MergeStringsArray) = vbArray Or vbString Then Dim i As Long ReDim MergeStrings(UBound(MergeStringsArray) - 1) For i = 0 To UBound(MergeStringsArray) - 1 MergeStrings(i) = MergeStringsArray(i) Next i Else ReDim MergeStrings(0) End If End If
If Not IsMissing(MergeStringsArray) Then If VarType(MergeStringsArray) = vbArray Or vbString Then Dim i As Long ReDim MergeStrings(UBound(MergeStringsArray) - 1) For i = 0 To UBound(MergeStringsArray) - 1 MergeStrings(i) = MergeStringsArray(i) Next i Else ReDim MergeStrings(0) End If Else ReDim MergeStrings(0) End If
You can also run the EventLog Toolkit's AutoUpdate utility or contact us for the latest release files.
5. I'm passing insertion strings to the ReportEvent method, but it seems like the last insertion string passed in not sent?
The Event Log Toolkit's ReportEvent method should describe the MergeStringsArray as:
A zero based variant containing an array of strings (strings are numbered from 1 to N+1, leave array index zero and N+1 empty).
For example, when you call the ReportEvent method and you want to pass it 2 strings, Dim your MergeStringArray as:
ReDim mergestringarray(3) As String ' allocate 4 strings
mergestringarray(1) = "First insertion string"
mergestringarray(2) = "Second insertion string"
The Event Log Toolkit must be installed on a NT 4.0 (Service Pack 3 or later) system or Windows 2000 system. But, when distributing the Event Source file created by the Event Log Toolkit, only NT 4.0 or later is required. One function included in the dwEventLog class is a Windows 2000 only function and it is documented as such.
7. Can I include the dwEventLog class in my Visual Basic project?
As long as your Visual Basic project provide primary and significant functionality beyond that included in the dwEventLog class and you are not using the source code to develop or distribute components and tools that provide similar functionality.
8. What other files do I need to distribute with the Event Source file?
The only file you need to distribute is the Event Source file itself, and you can install it to any directory. Just be sure to register the file upon installation.
|Products Purchase Articles Support Company Contact