Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Text Property

Status
Not open for further replies.

SKimi

Mechanical
Joined
Feb 27, 2020
Messages
30
Location
IN
Hello,

I am trying to create a CAA function to access the flagged text from the drawing. I'm currently checking every character whether it is flagged. But using SetSelection method from CAA the tool seems to crash at that line of code even after i do a ResetReselection. Can anyone suggest me for any better solution/api/method.

THANKS in advance.
 
[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();
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top