I have created an Exe ATL for logging of information to the NT event Logger. I have tested it using VB and it works fine, but when I try from a MFC application it causes an Access Violation. The only information from the tbl file is as follows:

void ILogger::OpenLog()
{
InvokeHelper(0x1, DISPATCH_METHOD, VT_EMPTY, NULL, NULL);
}

void ILogger::CloseLog()
{
InvokeHelper(0x2, DISPATCH_METHOD, VT_EMPTY, NULL, NULL);
}

void ILogger::LogEvent(long lEventNumber, long lCategory, LPCTSTR szDescription)
{
static BYTE parms[] =
VTS_I4 VTS_I4 VTS_BSTR;
InvokeHelper(0x3, DISPATCH_METHOD, VT_EMPTY, NULL, parms,
lEventNumber, lCategory, szDescription);
}

I have tried a Number of ways to create an instance of the ATL including CoCreateInstance, all function calls returns are check for S_OK. When I then try To call OpenLog() the violation occurs.


Has anybody got any hits or clues to resolue my problem.