高级会员
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
|
【转帖】通过按钮关闭autocad?
通过按钮关闭autocad?
通过按钮关闭autocad?
在autocad中,无模式对话框上的按钮关闭,点击把autocad关闭,该如何作啊?
autocad直接关闭,默认是"不保存",不要再选择什么"是否要保存"的对话框了!
高手指教!!!
用idocument的close()方法就可以实现........................
我不大清楚你说的这个,能详细的说一下吗?
谢谢
idocument 是cad的一个接口,利用这个接口的方法close()可以实现
idocument idoc;
idoc.attachdispatch(iapp.get_activedocument());
idoc->close(vfull,vnull);
这个idocument用的时候需要什么头文件吗?
编译时不认啊!!
用类向导->add class按钮->from a type libraly....
选择cad2安装目录下的acad.tlb
-> 选择iacadapplication,iacaddocument,iacaddocuments等(可以根据自己需要添加接口)
->得到acad.h acad.cpp2个文件,然后#include "acad.h" 就可以用了。
我改成这样的
iacaddocument idoc,iapp;
idoc.attachdispatch(iapp.get_activedocument());
idoc->close(vfull,vnull);
可是还是出错啊,梦幻神话高手帮我看看!!
错误是:
compiling...
xitong.cpp
f:\haohuibin\testarx\xitong.cpp(288) : error c2039: 'get_activedocument' : is not a member of 'iacaddocument'
f:\haohuibin\testarx\acad.h(5) : see declaration of 'iacaddocument'
f:\haohuibin\testarx\xitong.cpp(289) : error c2819: type 'iacaddocument' does not have an overloaded member 'operator ->'
f:\haohuibin\testarx\acad.h(5) : see declaration of 'iacaddocument'
f:\haohuibin\testarx\xitong.cpp(289) : error c2227: left of '->close' must point to class/struct/union
f:\haohuibin\testarx\xitong.cpp(289) : error c2065: 'vfull' : undeclared identifier
f:\haohuibin\testarx\xitong.cpp(289) : error c2065: 'vnull' : undeclared identifier
error executing cl.exe.
cadittestarx.arx - 5 error(s), 0 warning(s)
1、如果你用的是vc6.0 的话:
idoc.attachdispatch(iapp.getactivedocument());
idoc->close(vfull,vnull);
2、接口要用到变体 首先定义:
colevariant vnull(""),
vtrue((short)true),
vfull((short)false);
这个iacad是给别的程序用的ole包装类啊, 在cad里面自己用自己的ole..-__-
而且这似乎是关闭文件不保存, 不是关闭整个cad程序不保存啊..
直接结束cad的话在按钮上用win api的::exitprocess()就好了吧..
virtue is like a rich stone, best plain set.
-- francis bacon, <of beauty>
谢谢上面两位大侠!!!!ok
|