ShowAutoTrimDlg example for C++ Builder

void __fastcall TForm1::ShowAutoTrimDlg1Click(TObject *Sender) 
{
   L_INT nRet; 

   LEADDlgImage1->DlgFlags = DLG_AUTOTRIM_AUTOPROCESS |
                           DLG_AUTOTRIM_SHOW_PREVIEW; 

   LEADDlgImage1->LEADImage = LEADImage1; 
   LEADDlgImage1->LEADDlgService = LEADDlgService1; 

   nRet= LEADDlgImage1->ShowAutoTrimDlg ( this ); 
   if ( nRet == SUCCESS_DLG_OK ) 
   {
      LEADImage1->AutoTrim ( LEADDlgImage1->Threshold ); 
   }
}