????? C++ ?? ????? ?? ???? ????? ??? ??? ????? ?? ??? ???? ????

???? ?????? ???? ??????
???? ID: 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 ?????, Windows 2000 ?????, ?? Windows NT 4.0 ????? ????? ????
  • Microsoft Visual Studio .NET
  • Microsoft Visual Studio 2005

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

????? ?????? ?????????? ????????? ?? ????????? ?????? ?? ??????? ???? ?? ??? ???? ??????????? ?? ??? ????, centralized ????? ?? ?????? ????? ??? Windows ??? ??? ????? ?? ??? ?? ???? ?????????? ??????? supplies: ????? ??????? ??????? ???? ??-???? ?? ????? ?????????????, ?? ?? ???? ??? ?? ????? ??????? ?? ?????? ??????????, ????? ??, ?????? ???? ?? ??? ?????? ????? ??? ?? ???????????? ??? ?? ???? ?? ??? ?????? ?? ?? ???? ??? ?? ?? ?????? ??? ???????????? ?? ????, ?? ???? ????? ????? ??? ?????? ???? simplest ??????? ??? ??? ????? ??? ???? ?? ??? ???? involves ?? ????? ????????? ????? ?? ??? ?? ????

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

    ???:????? C++ .NET 2003, ?? ????? ?? ???? ????:
    1. ?? ???????????????? ??????????? ????,????? C++ ?????????.
    2. ?? ???????????????????? ????,????? ????????? (.NET).
    ????? C++ 2005, ??? ?? ????? ?? ???? ????:
    1. ?? ???????????????? ??????????? ????,????? C++.
    2. ?? ???????????????????? ????,CLR ????? ?????????.
  3. ??? ?? ??? ????? ?????? ?????? system.dll ???? ?? ??? ??? ?????? ??? ??????:
    #using <system.dll>
  4. ?? ????? ???? ??? ????? ?? directive??????, ??System::Diagnostics???????? ???? ?? ??? ??? ???? ??? ??? ?? ???????? ?? declarations ????? ????? ?? ??? ?? ????? ?? ???? ?? ???? declarations ???? ?? ???? ????? ??? ?? ????? ???? ?????? ??:
    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???? ??, ?? ????????? ??? ??? ????? ??? ???
    if(!EventLog::SourceExists(sSource)) EventLog::CreateEventSource(sSource,sLog);
    
  7. ??? ????? ??? ???? ?? ??? ??? ????? ?????, ???? ?? ??? ?? ????? ?????? ????? ?? ???? ???EventLog.WriteEntry. ?? ???? ?? ?? ???? overloaded ??????? ??? ????? ????? ??? simplest ?????? ?? ?????? ?? (?? ???? ???? ????? ???????? ?? ???? ?????), ?? ?? ???? ???? ??????? (?? ????? ?????? ?? ????? ID ?? ????????? ???? ?? ?????? ???? ??):
    EventLog::WriteEntry(sSource,sEvent);
    	EventLog::WriteEntry(sSource, sEvent, EventLogEntryType::Warning, 235);
  8. ???? ????????? ?? ??????? ???? ????????? ?????, ?? ???? ??? ???? ?? ????? ?? ????? ?? ??? ????? ?????? ??? ????????? ??? ?? ???? ?????

????? C++ ??? ??? ??????? ?????? ???

#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;
}

????? 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;
}

???

???? ID: 815661 - ????? ???????: 05 ?????? 2010 - ??????: 2.0
???? ???? ???? ??:
  • Microsoft Visual C++ 2005 Express Edition
  • Microsoft Visual C++ .NET 2003 Standard Edition
  • Microsoft Visual C++ .NET 2002 Standard Edition
??????: 
kbdebug kbhowtomaster kbeventlog kbhowto kbmt KB815661 KbMthi
???? ?????? ????????
??????????: ?? ???? ?? ???? ??????? ?? ????? ?? Microsoft ????-?????? ?????????? ?????? ?????? ???? ??? ??. Microsoft ???? ??? ????-???????? ?? ????-???????? ????? ?????? ?? ???? ???????? ???? ?? ???? ????? ????? ??? ?? ??? ?????? ?? ???? ???? ???? ??? ????? ??. ???????, ????-???????? ???? ????? ???? ???? ???? ???. ?????, ????????, ?????-???? ?? ??????? ?? ???????? ?? ???? ???, ???? ?? ??? ?????? ???? ???? ??? ????? ??? ?? ???? ??. Microsoft ??????? ??? ???? ?? ?????? ?? ??????????, ????????? ?? ??? ?????? ?? ???? ????? ?? ???? ???????? ?? ??? ???? ????? ?? ??? ????????? ???? ??. Microsoft ????-?????? ?????????? ?? ????? ?????? ?? ?? ??? ??.
?????????? ?? ??????? ????????? ??????? ??: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