easypower 发表于 2006-1-25 15:29:00

关于程序启动是关闭命令行对话框

有两个问题需要解决:
1.关闭命令行对话框
代码:

                CWnd *pWnd = acedGetAcadDockCmdLine();
                if(pWnd)
                {
                        pWnd = pWnd->GetParent();
                        if(pWnd)
                        {
                                pWnd = pWnd->GetParent();
                                if(pWnd)
                                {
                                        pWnd->ModifyStyle(0,WS_VISIBLE|WS_OVERLAPPED);
                                        pWnd->ShowWindow(SW_HIDE);
                                        pWnd->RedrawWindow();
                                        acedGetAcadFrame()->RecalcLayout();
                                }
                        }
                }


已经解决。
2.程序启动时起作用
最初以为直接在On_kInitAppMsg消息中运行上述代码即可,事实上不起作用,感觉关闭之后又显示出来了。(另外如果要在On_kInitAppMsg消息中控制视图zoom-e也不可以,控制视图代码如下)
代码:

void CGlobalFuns::zoomExt()
{
        // get the extents of the drawing
        AcDbViewTableRecord view;
        AcGePoint3d max =
                acdbHostApplicationServices()->workingDatabase()->extmax(),
                min = acdbHostApplicationServices()->workingDatabase()->extmin();        AcGePoint2d max_2d (max, max);
        AcGePoint2d min_2d (min, min);
        // now set the view centre point
        view.setCenterPoint (min_2d + (max_2d - min_2d) / 2.0);
        // now height and width of view
        view.setHeight(max_2d - min_2d);
        view.setWidth (max_2d - min_2d);
        // set the view
        acedSetCurrentView (&view, NULL);
        // updates the extents
        acdbHostApplicationServices()->workingDatabase()->updateExt(TRUE);
}


于是只好用2004doc.lsp实现,发现也不尽如人意,讨论一下。
页: [1]
查看完整版本: 关于程序启动是关闭命令行对话框