在非模式对话框中使用acedcommand(),返回错误-5001,在ObjectARX的文档中有如下说明:
Code Differences under the Application Execution Context
In the cases of modeless dialogs and external process-generated ActiveX requests, the code must lock the documents, including the current document. The use of the IAcadDocument methods StartUndoMarker() and EndUndoMarker() will apply a kWriteLock to the document.
解决方法:用SendMessage()或sendStringToExecute()代替acedcommand。
CString strCmd;
strCmd.Format("ucs/nm/nz/n%f/n",z);
for(int i=0;i<strCmd.GetLength();i++){
::SendMessage(acedGetAcadTextCmdLine()->m_hWnd,WM_CHAR,strCmd[i],1L);
}