GetRecognizedCharacters Example for C++ 5.0 and later

void CSample_COMDlg::OnButton26()
{
   pRasterDoc->SpellLanguageID = LANGID_ENGLISH; 
   pRasterDoc->EnableSaveResultsToMemory = FALSE; 
   pRasterDoc->RecognitionDataFileName = "c:\\test.rdf";

   int nRet = pRasterDoc->Recognize (0, 0); 
   if (nRet == 0) 
   {
      ILTDocumentOptions* pDocumentOptions = NULL; 
      int nCharsCount; 

      pRasterDoc->GetRecognizedCharacters (0); 
      nCharsCount = pRasterDoc->RecognizedCharactersCount

      for (int i = 0; i < nCharsCount; i++)
      {
         if (pRasterDoc->GetRecognizedCharacter (i)->Confidence > 900) 
         {
            short iFont = pRasterDoc->GetRecognizedCharacter(i)->Font

            iFont |= FONT_BOLD | FONT_UNDERLINE; 
            pRasterDoc->GetRecognizedCharacter(i)->Font = iFont; 
            pRasterDoc->GetRecognizedCharacter(i)->FontSize = 20; 

            if (pRasterDoc->GetRecognizedCharacter(i)->Flags & CHAR_ENDOFWORD == CHAR_ENDOFWORD) 
            {
               CString csBuffer; 

               csBuffer.Format (TEXT("The last character in the word is available at the following position\nLeft = %d\nTop = %d\nWidth = %d\nHeight = %d\nYOffset = %d\n"),
                               pRasterDoc->GetRecognizedCharacter(i)->Left
                               pRasterDoc->GetRecognizedCharacter(i)->Top
                               pRasterDoc->GetRecognizedCharacter(i)->Width
                               pRasterDoc->GetRecognizedCharacter(i)->Height
                               pRasterDoc->GetRecognizedCharacter(i)->YOffset); 

               AfxMessageBox(csBuffer); 

               csBuffer.Format (TEXT("First guess char = %s\nSecond guess char = %s\nThird guess char = %s\n"),
                               pRasterDoc->GetRecognizedCharacter(i)->GuessCode
                               pRasterDoc->GetRecognizedCharacter(i)->GuessCode2
                               pRasterDoc->GetRecognizedCharacter(i)->GuessCode3); 

               AfxMessageBox(csBuffer); 

               csBuffer.Format (TEXT("First Language Id = %d\nSecond Language Id = %d\nZone Index = %d\nCell Index = %d\Space = %d\nSpace Error = %d\n"),
                               pRasterDoc->GetRecognizedCharacter(i)->LanguageId
                               pRasterDoc->GetRecognizedCharacter(i)->LanguageId2
                               pRasterDoc->GetRecognizedCharacter(i)->ZoneIndex
                               pRasterDoc->GetRecognizedCharacter(i)->CellIndex
                               pRasterDoc->GetRecognizedCharacter(i)->Space, 
                               pRasterDoc->GetRecognizedCharacter(i)->SpaceErr); 

               AfxMessageBox(csBuffer); 
            }
         }
      }
      
      pRasterDoc->SetRecognizedCharacters (0); 
      pRasterDoc->GetRecognitionResultOptions ();

      pRasterDoc->GetResultOptions ()->Format = DOCRTF_WORD_2000; 
      pRasterDoc->GetResultOptions ()->FormatLevel = FORMATLEVEL_FULL; 

      pRasterDoc->GetResultOptions ()->GetDocumentOptions ()->PaperSizeMode = SELPREDEFINED; 
      pRasterDoc->GetResultOptions ()->GetDocumentOptions()->PaperType = PAPER_A4; 
      pRasterDoc->GetResultOptions ()->GetDocumentOptions()->PaperOrientation = PAPER_ORIENT_PORTRAIT; 
      pRasterDoc->GetResultOptions ()->GetDocumentOptions()->Color = COL_ORIGINAL; 
      pRasterDoc->GetResultOptions ()->GetDocumentOptions()->EnableTextInBoxes = FALSE; 
      pRasterDoc->GetResultOptions ()->GetDocumentOptions()->MarginLeft = 5; 
      pRasterDoc->GetResultOptions ()->GetDocumentOptions()->MarginTop = 5; 
      pRasterDoc->GetResultOptions ()->GetDocumentOptions()->MarginWidth = 200; 
      pRasterDoc->GetResultOptions ()->GetDocumentOptions()->MarginHeight = 200; 
      pRasterDoc->GetResultOptions ()->GetDocumentOptions()->EnablePageBreaks = TRUE; 
      pRasterDoc->GetResultOptions ()->GetDocumentOptions()->TableMethod = TM_USETABS; 

      pRasterDoc->SetRecognitionResultOptions ();
      pRasterDoc->SaveDocument ("c:\\test.doc");
   }
}