EnableMethodErrors example for C++ Builder

This example disables method errors temporarily so that it can give the user guidance about a particular error (an out-of-range shear angle using ILEADRasterProcess in this case).

   //Declare local variables.
   short ShearAngle, nRet;
   AnsiString cMsg;
   LEADRasterProcess* pRasterProc= NULL;

     CoCreateInstance(CLSID_LEADRasterProcess, NULL, CLSCTX_ALL, IID_ILEADRasterProcess, (void**)&pRasterProc);
   ShearAngle= 9000 ;// This would be the user's input * 100
   pRasterProc->EnableMethodErrors = False;
   nRet= pRasterProc->Shear (LEADRasterView1->Raster, ShearAngle, True, RGB(0, 0, 255));
   if (nRet == 20013)
   {
      cMsg= "The angle cannot be more than 45 degrees";
      MessageBox (Handle, cMsg.c_str(), "Error", MB_OK);
   }
   else
   {
      if (nRet == 0)
         LEADRasterView1->ForceRepaint ();
      else
         ShowMessage ( "Error: " + IntToStr (nRet)) ;
   }
   pRasterProc-> Release( );