Reading the content of the command window

As many of you know, it is possible to completely disable the command window in AutoCAD OEM. That means the user won’t need a keyboard and can access commands from the Ribbon and Toolbar menus by using a pointing device or touch input only. However, for those who keep the command window enabled, sometimes there’s a need to be able to read what is echoed in the command window.

This is adapted from an ADN blog post from 2012 by Fenton Webb that explains how this is done:

// 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

    // if we don't have any text
    if (str.GetLength() <= 0)
        pChild = pChild->GetNextWindow();
        // display the text
        AfxMessageBox(str, MB_OK);
1 Like