Có, hãy xem hàm ReportEvent và example.
Hồ sơ sự kiện nguồn cung cấp với phần mở rộng .mc trông như thế này:
; // MyEventProvider.mc
; // This is the header section.
SeverityNames=(Success=0x0:STATUS_SEVERITY_SUCCESS
Informational=0x1:STATUS_SEVERITY_INFORMATIONAL
Warning=0x2:STATUS_SEVERITY_WARNING
Error=0x3:STATUS_SEVERITY_ERROR
)
FacilityNames=(System=0x0:FACILITY_SYSTEM
Runtime=0x2:FACILITY_RUNTIME
Stubs=0x3:FACILITY_STUBS
Io=0x4:FACILITY_IO_ERROR_CODE
)
LanguageNames=(English=0x409:MSG00409)
; // The following are the categories of events.
MessageIdTypedef=WORD
MessageId=0x1
SymbolicName=NETWORK_CATEGORY
Language=English
Network Events
... rest of file omitted
File .mc được biên dịch thành một file res được liên kết thành một .dll:
Để biên dịch file văn bản thông báo, sử dụng lệnh sau:
mc -U provider.mc
Để biên dịch các nguồn lực mà các trình biên dịch thông điệp được tạo ra, sử dụng lệnh sau:
rc provider.rc
Để tạo DLL tài nguyên duy nhất có chứa các nguồn tài nguyên chuỗi bảng tin nhắn, sử dụng lệnh sau (bạn có thể chạy lệnh từ một Visual Studio Prompt Command):
link -dll -noentry provider.res
...
Để thực hiện việc này theo lập trình, bạn có thể muốn bắt đầu từ [tại đây] (http://msdn.microsoft.com/en-us/library/dd996928 (v = vs.85) .aspx). – Jon