????? ??????? ??? ??? ??????? ???????? Visual C++

?????? ????????? ?????? ?????????
???? ???????: 815661 - ??? ???????? ???? ????? ????? ??? ???????.
?????? ??? ????? Microsoft Visual C# .NET ?? ??? ???????? ???? 307024.
?????? ??? ????? Microsoft Visual Basic .NET ?? ??? ???????? ???? 301279.

???? ??? ??????? ??? ??????? Microsoft ".NET Framework ??? ?????" ?????? ???????:
  • ??????
  • System.Diagnostics
????? ???? | ?? ????

?? ??? ??????

????? ???

???? ??? ??????? ???? ????? ??? ????? ????? ????????? ?????? ?? ??? ??? ????? ???? ??????? ?? ???? ??????? Microsoft .NET Framework.

??????? ????

???????

???? ??????? ??????? ??????? ?????? ??? ????? ?????? ???????? ?????? ? ??? ??????? ???? ???????:
  • Microsoft Windows 2000 Professional, Windows 2000 Server Windows 2000 ?????? ???? ?? ???? Windows NT 4.0
  • Microsoft Visual Studio .NET
  • Microsoft Visual Studio 2005

??????? ??? ??? ???????

???? ????? ??????? ????? ?????? ??????? ????????? ?????? ?? ?????? ??????? ?????? ??????? ????????. ???? Windows ????? ?????? ?????? ???? ???????: "???? ???????". ???????? ???? ??? ??????? ??? ????? ????? ??????? ???? ??????? ?? ????? ??????? ???????? ??????? ??? ????? ????????? ??????? ???????? ??????? ???????? ????? ??? ???????. ????? ????? ????? ??????? ?? ????? ?????? ?????? ????? ??????? ???????. ?? ??????? ??????? ??? ??? ??????? ????? ?????? ?? ??????? ?????? ????? ?????.

?????? ????? ???? ??????? ???????:
  1. ??? ????? Visual Studio .NET ?? Visual Studio 2005.
  2. ????? ????? Visual C++ ????? C++ ??????? ????.

    ?????? ?? Visual C++ .NET 2003? ???? ??????? ???????:
    1. ??? ????? Project ? ???? ??? ?????? Visual C++.
    2. ??? ????? ? ???? ??? ????? ???? ?????? (.NET).
    ?? Visual C++ 2005? ???? ??????? ???????:
    1. ??? ????? Project ? ???? ??? Visual C++.
    2. ??? ????? ? ???? ??? ????? ???? ?????? CLR.
  3. ????? ???? ??? system.dll ?? ???? ????? ????? ?????? ??? ????????? ????????:
    #using <system.dll>
  4. ??????? ???????? ?????? ??? ?????? ????? "????" ? "System::Diagnostics ???? ?? ???? ????? ????????? ?? ?????? ??????? ??? ???? ??? ?? ????????? ???????? ?????? ??. ??? ?? ?????? ???????? ??????? ??? ?? ????????? ??????:
    using namespace System;
    using namespace System::Diagnostics;
  5. ??????? ??? ??? ??????? "? ??? ?? ???? ???? ??? ????? ?? ?????????: ?????? ?? ??? ????? ???? ???? ????? (??? ??? ????? ??? ?? ??? ??????? ??????) ?? ????? ???? ???? ?????. ????? ???? ????? ?? ??? ????? ???? ???; ??? ??? ???? ?? ????? ??????? ??? ???? ?? ??? ???? ??? ???? ????? ????? ??????.
    String *sSource;
    	String *sLog;
    	String *sEvent;
    
    	sSource = new String("dotNET Sample App1");
    	sLog = new String("Application1");
    	sEvent = new String("Sample Event1");
    
  6. ?????? ??????? ????? ????? ??? ??????? ?????? ?? ?? ??? ??? ???? ????? ??? ??? ?????? ??? ????? ?????? ???? ??? ????? ?? ??? ????? ????. ?? ???? ??? ???? ??? ????? ???? ?????, ??? ????? ????? ???????? ??? ????? ??? ????? ??? ?????. ?????????? ??? ?? ???? ??? ??? ??? ??????? CreateEventSource ??? ????? ?????? Log. ???????
    if(!EventLog::SourceExists(sSource)) EventLog::CreateEventSource(sSource,sLog);
    
  7. ???? ??????? ????? ???? EventLog.WriteEntry ?????? ????? ??? ??? ???????. ????? ??? ??????? ??? ??????? overloaded ??????. ????? ????? ????????? ???????? ?????? ????? ???? (??? ?????? ????? ???? ???????) ? ??? ?????? ???? ??????? (???? ????? ????? "???? ?????" ? "??? ?????):
    EventLog::WriteEntry(sSource,sEvent);
    	EventLog::WriteEntry(sSource, sEvent, EventLogEntryType::Warning, 235);
  8. ??? ??????? ????? ??. ?? ?????? ??????? ?? ?? ???? ?? ??? ??????? ?? "???? ???????" ???? ??????? ???????.

????? ??? ????????? ???????? ?? Visual C++. net

#include <tchar.h>
#using <system.dll>
#using <mscorlib.dll>

using namespace System;
using namespace System::Diagnostics;

int _tmain()
{
	String *sSource;
	String *sLog;
	String *sEvent;

	sSource = new String("dotNET Sample App1");
	sLog = new String("Application1");
	sEvent = new String("Sample Event1");

 if(!EventLog::SourceExists(sSource))
   EventLog::CreateEventSource(sSource,sLog);

	EventLog::WriteEntry(sSource,sEvent);
	EventLog::WriteEntry(sSource, sEvent,
		EventLogEntryType::Warning, 234);
	return 0;
}

????? ??? ????????? ???????? ?? Visual C++ 2005

#include <tchar.h>
#include <stdafx.h>
#using <system.dll>
#using <mscorlib.dll>

using namespace System;
using namespace System::Diagnostics;

int main()
{
	String ^sSource;
	String ^sLog;
	String ^sEvent;

	sSource = gcnew String("dotNET Sample App1");
	sLog = gcnew String("Application1");
	sEvent = gcnew String("Sample Event1");

 if(!EventLog::SourceExists(sSource))
   EventLog::CreateEventSource(sSource,sLog);

	EventLog::WriteEntry(sSource,sEvent);
	EventLog::WriteEntry(sSource, sEvent,
		EventLogEntryType::Warning, 234);
	return 0;
}

???????

???? ???????: 815661 - ????? ??? ??????: 11/?? ?????/1426 - ??????: 3.0
????? ???
  • Microsoft Visual C++ 2005 Express Edition
  • Microsoft Visual C++ .NET 2003 Standard Edition
  • Microsoft Visual C++ .NET 2002 Standard Edition
????? ??????: 
kbmt kbdebug kbhowtomaster kbeventlog kbhowto KB815661 KbMtar
????? ????
???: ??? ????? ??? ?????? ???????? ?????? ????? ???? ????? ?????????? ????? ?? ????????? ?????? ????. ???? ???? ?????????? ???? ?? ???????? ???????? ?????? ????????? ????? ????????? ???????? ????? ???????? ?????? ?? ?????? ??? ?? ???????? ???????? ?? ????? ??????? ?????? ??? ??????? ?????? ??. ?????? ?? ???? ??? ??????? ???????? ????? ?? ???? ????? ?????? ??? ????? ??? ????? ??????? ?? ????? ?? ?????? ??? ??? ??????? ??????? ?? ????? ????? ????? ????? ?????. ?? ????? ???? ?????????? ??????? ??? ????? ?? ??????? ?? ????? ?????? ?? ??? ????? ?? ????? ??????? ?? ???????? ?? ??? ???????. ???? ???? ?????????? ???????? ??? ????? ?????? ??????? ??????
???? ??? ????? ??????? ?????? ??????????815661

????? ???????

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com