[indent[/indent]int startString = 0;
while (startString < usInputString.GetLengthInChar())
{
int lengthOfString = usInputString.GetLengthInChar();
startString = usStringFoundInDoc.SearchSubString(usInputString, startString,CATUnicodeString::CATSearchModeForward);
if (startString == -1) break;
CATIDrwTextProperties *piDrwTextProps = NULL;
drawingText->get_TextProperties(drawingTextProps);
drawingTextProps->QueryInterface(IID_CATIDrwTextProperties, (void**)&piDrwTextProps);
piDrwTextProps->GetFrameType(oTextFrameType);
if (oTextFrameType == catNone)
{
CATIDftText *piDftText = NULL;
drawingText->QueryInterface(IID_CATIDftText, (void**)&piDftText);
wchar_t *ptextName = NULL;
piDftText->GetString(&ptextName);
CATIDrwSubString *piSubString = NULL;
piDftText->QueryInterface(IID_CATIDrwSubString, (void**)&piSubString);
// ****the next line of code is where CNEXT.exe file crashes******
piSubString->SetSelection(startString, lengthOfString, 1);
CATIDftTextProperties *piTextProp = NULL;
piDftText->GetTextProperties(&piTextProp);
DftFrameType oFrame;
piTextProp->GetFrameType(&oFrame);
piSubString->ResetSelection();
if (iFrameType == oFrame)
{
CATISpecObject *piSpecObj = NULL;
CATBaseDispatch* pDispatch = NULL;
drawingText->QueryInterface(IID_CATISpecObject, (void**)&piSpecObj);
piSpecObj->QueryInterface(IID_CATBaseDispatch, (void**)&pDispatch);
TextObjArray[nArraySize] = pDispatch;
nArraySize++;
}
}
startString = startString + usInputString.GetLengthInChar();
}