The Micro C++ Library
|
Win32 SDK related functions. More...
#include <micxx/windows/Win32SDK.hxx>
Inherits micxx::traits::NonCopyable.
Static Public Member Functions | |
static void | registerEventSource (const std::wstring &eventSource, const std::wstring &messageDll) |
Registers eventSource as an event source for the Event Log. | |
static void | reportEvent (const std::wstring &eventSource, DWORD eventID, const std::wstring &functionName, unsigned long error=GetLastError(), const std::wstring &message=L"") |
Writes an entry at the end of the specified event log. | |
static void | unregisterEventSource (const std::wstring &eventSource) |
Deletes all registry keys for eventSource from the Event Log. |
Win32 SDK related functions.
static void micxx::Win32SDK::registerEventSource | ( | const std::wstring & | eventSource, |
const std::wstring & | messageDll | ||
) | [static] |
Registers eventSource as an event source for the Event Log.
Event Viewer will not be able to map your eventIDs to message strings unless you register your eventSource (typically the name of your application) and provide a message file (typically a DLL that contains the message resources). The following steps are used to add eventSource to the registry:
SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application
"EventMessageFile"
and the type has to be REG_EXPAND_SZ
.static void micxx::Win32SDK::reportEvent | ( | const std::wstring & | eventSource, |
DWORD | eventID, | ||
const std::wstring & | functionName, | ||
unsigned long | error = GetLastError() , |
||
const std::wstring & | message = L"" |
||
) | [static] |
Writes an entry at the end of the specified event log.
Before you can write to the eventlog you need to add an event source to the registry.
eventSource | The name of the event source as it has to be registered under the registry key |
eventID | |
functionName | |
error | |
message | TODO: explain how to register micxx-msg.dll for serviceName |
static void micxx::Win32SDK::unregisterEventSource | ( | const std::wstring & | eventSource | ) | [static] |
Deletes all registry keys for eventSource from the Event Log.