VSAFireEvent Example

   Applies To

This example shows what a call to VSAFireEvent 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.

// Prepare to generate an event. Define an array to hold
// event parameters

#define MAXPARAMS 2

// Generate the event.
// str_SAMPLE_EVENT_GUID is the GUID of the registered event to generate
static void RpcSampleFireEvent(long VSAId)
{
   // Event data is passed in arrays of parameter names (keys) and
   // values.
   // This array holds the parameter names.
   wchar_t * rgKeys[MAXPARAMS];
   wchar_t * rgValues[MAXPARAMS];
      
   rgKeys[0] = L"Custom Field 1";
   rgKeys[1] = L"Custom Field 2";
   rgValues[0] = L"Custom value 1";
   rgValues[1] = L"Custom value 2";
      
   RpcTryExcept
   {
      VSAFireEvent(VSAId,str_SAMPLE_EVENT_GUID, 
         MAXPARAMS,
         rgKeys, rgValues,
         0,0,                //dwTimeLow and dwTimeHigh values
         cVSAEventDefaultSource | cVSAEventDefaultTarget);
   }
   RpcExcept(1)
   {
      LastErrorCode = RpcExceptionCode();
   }
   RpcEndExcept;
}