Hey all! Long time no see. I'm using the LogNTEvent subroutine below
(don't remember where I got it from), but it's not working quite right.
I see my error message in the NT Application Event Log, but there is a
bunch of other junk pre-pended to it. Here's the message in the Event
Log:
The description for Event ID ( 1 ) in Source ( My Test Service )
cannot be found. The local computer may not have the necessary
registry information or message DLL files to display messages from
a remote computer. The following information is part of the event:
My Test Service failed to get global service settings. Error
Description: [Microsoft][ODBC Microsoft Access Driver] Could not
find file '(unknown)'..
My actual error message is in bold. Below is the function I'm using.
I've seen other posts on Google Newsgroups for similar error messages
but no real answers. Any clues? Thanks in advance! -Scott
------------------
Scott Wolfington
http://www.boogietools.com
[This message has been edited by Scott Wolfington (edited March 05, 2003).]
(don't remember where I got it from), but it's not working quite right.
I see my error message in the NT Application Event Log, but there is a
bunch of other junk pre-pended to it. Here's the message in the Event
Log:
The description for Event ID ( 1 ) in Source ( My Test Service )
cannot be found. The local computer may not have the necessary
registry information or message DLL files to display messages from
a remote computer. The following information is part of the event:
My Test Service failed to get global service settings. Error
Description: [Microsoft][ODBC Microsoft Access Driver] Could not
find file '(unknown)'..
My actual error message is in bold. Below is the function I'm using.
I've seen other posts on Google Newsgroups for similar error messages
but no real answers. Any clues? Thanks in advance! -Scott
Code:
SUB LogNTEvent(Message AS STRING, LogCode AS LONG) ' This method adds Message to the NT Event Log. ON ERROR GOTO Error_LogNTEvent DIM dwdRet AS DWORD DIM dwdPtr AS DWORD DIM lngHEvent AS LONG DIM lngMessageSize AS LONG DIM lngRet AS LONG IF ISTRUE(LogCode AND %EVENTLOG_LEVEL) THEN ' This event can be logged. lngHEvent = RegisterEventSource(BYVAL %NULL, g_asczServiceDisplayNam) IF lngHEvent <> %NULL THEN lngMessageSize = LEN(Message) + 1 dwdPtr = STRPTR(Message) lngRet = ReportEvent(lngHEvent, LogCode, 0, 1, BYVAL 0&, 1, 0&, BYCOPY dwdPtr, BYVAL %NULL) dwdRet = GetLastError() DeregisterEventSource lngHEvent END IF END IF EXIT SUB Error_LogNTEvent: IF lngHEvent <> %NULL THEN DeregisterEventSource lngHEvent END IF END SUB
Scott Wolfington
http://www.boogietools.com
[This message has been edited by Scott Wolfington (edited March 05, 2003).]
Comment