[求助]关于非模式对话框下调用acedCommand()函数的问题。
我在ARX下写了一个非模式对话框,非模式对话框中有个ListBox控件,获取一些信息,然后我想通过选取ListBox控件中的项实现跳转到CAD图形的指定坐标位置,程序运行无误,但是没有实现跳转,没有任何反应。程序代码如下,请高手指点。void CPLineDlg::OnSelchangePlineList() // CPLineDlg为定义的非模式对话框//此函数为非模式对话框下的ListBox控件的选取功能函数
{
int index=m_CtrlPLListBox.GetCurSel();
double CurX,CurY;
CurX=XGPtArray;
CurY=XGPtArray;
ads_point CurPt;
ads_real rel=0.5;
CurPt=CurX;
CurPt=CurY;
CurPt=0;
acDocManager->lockDocument(curDoc());
//*******************************************************************************************************************************
if (acedCommand(RTSTR,"_ZOOM",RTSTR,"C",RT3DPOINT,CurPt,RTREAL,rel,NULL)==RTNONE)//
{
AfxMessageBox("跳转失败!");
}
//此行程序运行没反应
//*******************************************************************************************************************************
acDocManager->unlockDocument(curDoc());
acutPrintf("\nok");//输出正常
acedAlert("ok");//此行也执行正常
//acedCommand不行,acutPrintf和acedAlert都可以。为什么呢?都是一样的全局函数啊。
}
acedCommand命令不能嵌套太深!!! 由于当前焦点在自己对话框上,需要激活CAD视图 在非模式对话框中使用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;im_hWnd,WM_CHAR,strCmd,1L);
}
页:
[1]