by Fenton Webb
The ObjectARX API includes a function acedGetAcadTextCmdLine() that gives you
CWnd MFC access to the Command Line window. The Command Line window has various child CWnd windows (depending on the AutoCAD version you are running on) which we need to loop through to find the text, so just using normal Win32 we can very easily iterate through the child window list and extract the text.
Here’s how…
// get the command line CWnd container
CWnd* pDock = (CWnd*)acedGetAcadTextCmdLine();
// get the child window
CWnd* pChild = pDock->GetWindow(GW_CHILD);
// loop while we have children
while (pChild!=NULL)
{
CString str;
// get the window text
pChild->GetWindowText(str);
// if we don’t have any text
if (str.GetLength() <= 0)
pChild = pChild->GetNextWindow();
else
{
// display the text
MessageBox(NULL, str);
break;
}
}

Leave a Reply