VSABeginSession Example

   Applies To

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

// Begin a session with the component.
// str_SAMPLE_SOURCE_GUID identifies the component.
// Specify a name (Sample Session Name) to uniquely identify the session
// to Visual Studio Analyzer. The session name must be unique for each
// time, each component, and each run of the component.
static void RpcSampleBeginSession(long VSAId)
{
   RpcTryExcept
   {
      VSABeginSession(VSAId,str_SAMPLE_SOURCE_GUID,L"Sample Session Name");
   }
   RpcExcept(1)
   {
      LastErrorCode = RpcExceptionCode();
   }
   RpcEndExcept;
}