VC访问EventLog的问题,急!!!在线等!!
zrcat 2004-02-03 05:46:44 源代码:
#using <mscorlib.dll>
#using <System.dll>
using namespace System;
using namespace System::Diagnostics;
using namespace System::Threading;
void CClientDlg::OnBnClickedButtonTest()
{
//按钮相应的处理代码
if(!EventLog::SourceExists(S"MySource")){
EventLog::CreateEventSource(S"MySource", S"MyNewLog");
Console::WriteLine(S"CreatingEventSource");
}
// Create an EventLog instance and assign its source.
EventLog* myLog = new EventLog();//出错行
myLog->Source = S"MySource";
// Write an informational entry to the event log.
myLog->WriteEntry(S"Writing to event log.");
}
编译时提示:
ClientDlg.cpp(443) : error C3828: 'System::Diagnostics::EventLog': placement arguments not allowed while creating instances of managed classes
该怎么改呢??高手帮帮忙吧