This example shows what a call to VSARegisterCustomEvent looks like. Refer to VsaRpcl Example to see the constant declarations and to see this code in a form you can run with minor modifications.
// Register a user-defined event for the component to generate.
// str_SAMPLE_SOURCE_GUID is the component that will generate the event
// being registered.
// str_SAMPLE_EVENT_GUID is a unique GUID for the event (defined in
// preceding code); substitute the GUID for your component.
// Assign a Name (Sample Event) and Description (Event generated by the
// component) using Unicode characters.
static void RpcSampleRegisterCustomEvent()
{
RpcTryExcept
{
VSARegisterCustomEvent(
str_SAMPLE_SOURCE_GUID,
str_SAMPLE_EVENT_GUID,
L"Sample Event",
L"Event generated by the sample event source",
DEBUG_EVENT_TYPE_GENERIC,
str_SAMPLE_CATEGORY_GUID
);
}
RpcExcept(1)
{
LastErrorCode = RpcExceptionCode();
}
RpcEndExcept;
}