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

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

<BR><FONT face=宋体 size=2>有两个问题需要解决:<BR>1.关闭命令行对话框<BR></FONT>
<DIV style="MARGIN: 5px 20px 20px">
<DIV class=smallfont style="MARGIN-BOTTOM: 2px"><FONT face=宋体,verdana,arial,helvetica>代码:</DIV><PRE class=alt2 style="BORDER-RIGHT: 1px inset; PADDING-RIGHT: 6px; BORDER-TOP: 1px inset; PADDING-LEFT: 6px; PADDING-BOTTOM: 6px; MARGIN: 0px; OVERFLOW: auto; BORDER-LEFT: 1px inset; WIDTH: 99%; PADDING-TOP: 6px; BORDER-BOTTOM: 1px inset"><FONT style="FONT-SIZE: 10pt" face="宋体,verdana, Airal,Helvetica,Geneva">
<FONT face="courier new">
&#9;&#9;CWnd *pWnd = acedGetAcadDockCmdLine();
&#9;&#9;if(pWnd)
&#9;&#9;{
&#9;&#9;&#9;pWnd = pWnd-&gt;GetParent();
&#9;&#9;&#9;if(pWnd)
&#9;&#9;&#9;{
&#9;&#9;&#9;&#9;pWnd = pWnd-&gt;GetParent();
&#9;&#9;&#9;&#9;if(pWnd)
&#9;&#9;&#9;&#9;{
&#9;&#9;&#9;&#9;&#9;pWnd-&gt;ModifyStyle(0,WS_VISIBLE|WS_OVERLAPPED);
&#9;&#9;&#9;&#9;&#9;pWnd-&gt;ShowWindow(SW_HIDE);
&#9;&#9;&#9;&#9;&#9;pWnd-&gt;RedrawWindow();
&#9;&#9;&#9;&#9;&#9;acedGetAcadFrame()-&gt;RecalcLayout();
&#9;&#9;&#9;&#9;}
&#9;&#9;&#9;}
&#9;&#9;}
</FONT>
</FONT></PRE></FONT></DIV>
<DIV></DIV><BR><BR>已经解决。<BR><BR>2.程序启动时起作用<BR>最初以为直接在On_kInitAppMsg消息中运行上述代码即可,事实上不起作用,感觉关闭之后又显示出来了。(另外如果要在On_kInitAppMsg消息中控制视图zoom-e也不可以,控制视图代码如下)<BR></FONT>
<DIV style="MARGIN: 5px 20px 20px">
<DIV class=smallfont style="MARGIN-BOTTOM: 2px"><FONT face=宋体,verdana,arial,helvetica>代码:</DIV><PRE class=alt2 style="BORDER-RIGHT: 1px inset; PADDING-RIGHT: 6px; BORDER-TOP: 1px inset; PADDING-LEFT: 6px; PADDING-BOTTOM: 6px; MARGIN: 0px; OVERFLOW: auto; BORDER-LEFT: 1px inset; WIDTH: 99%; PADDING-TOP: 6px; BORDER-BOTTOM: 1px inset"><FONT style="FONT-SIZE: 10pt" face="宋体,verdana, Airal,Helvetica,Geneva">
<FONT face="courier new">
void CGlobalFuns::zoomExt()
{
&#9;// get the extents of the drawing
&#9;AcDbViewTableRecord view;
&#9;AcGePoint3d max =
&#9;&#9;acdbHostApplicationServices()-&gt;workingDatabase()-&gt;extmax(),
&#9;&#9;min = acdbHostApplicationServices()-&gt;workingDatabase()-&gt;extmin();

&#9;AcGePoint2d max_2d (max, max);
&#9;AcGePoint2d min_2d (min, min);
&#9;// now set the view centre point
&#9;view.setCenterPoint (min_2d + (max_2d - min_2d) / 2.0);
&#9;// now height and width of view
&#9;view.setHeight(max_2d - min_2d);
&#9;view.setWidth (max_2d - min_2d);
&#9;// set the view
&#9;acedSetCurrentView (&amp;view, NULL);
&#9;// updates the extents
&#9;acdbHostApplicationServices()-&gt;workingDatabase()-&gt;updateExt(TRUE);
}
</FONT>
</FONT></PRE></FONT></DIV>
<DIV></DIV><BR><BR>于是只好用autocad2004doc.lsp实现,发现也不尽如人意,讨论一下。</FONT>
页: [1]
查看完整版本: 关于程序启动是关闭命令行对话框