This example shows what a call to VSARegisterEventCategory 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 custom event category for the component.
// str_SAMPLE_SOURCE_GUID is the component for the category being
// registered.
// str_SAMPLE_CATEGORY_GUID is a unique GUID for the category (defined
// in preceding code); substitute the GUID for your component.
// If you want the category to appear in a hierarchy, specify a parent
// (str_DEBUG_EVENT_CATEGORY_ALL will be the parent of this category).
// If you do not specify a parent, your category will appear at the top
// level in the Filter Editor.
// Assign a name (Sample Event Category) and description
// (Category for all sample events) using Unicode characters.
static void RpcSampleRegisterCategory()
{
RpcTryExcept
{
VSARegisterEventCategory(
str_SAMPLE_SOURCE_GUID,
str_SAMPLE_CATEGORY_GUID,
str_DEBUG_EVENT_CATEGORY_ALL,
L"Sample Event Category",
L"Category for all sample events"
);
}
RpcExcept(1)
{
LastErrorCode = RpcExceptionCode();
}
RpcEndExcept;
}