找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 392|回复: 3

[求助]:如何使用程序卸载一个已经加载的.ARX程序?

[复制链接]
发表于 2004-5-29 13:46:57 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?立即注册

×
刚刚学习ObjectARX编程,遇到一个问题“如何卸载一个已经加载的.ARX程序?”
我想解决的方法有三种:
一、在AutoCAD中调用Appload命令卸载已经加载的程序;
二、使用所加载程序中自身的卸载命令;
三、调用第三个程序中的命令(专用卸载命令)卸载已加载的程序。
但是我自己对ObjectARX了解不多,没办法实现后两个方法,请哪位大哥不吝赐教。
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!

已领礼包: 13个

财富等级: 恭喜发财

发表于 2004-5-31 00:18:09 | 显示全部楼层

Re: [求助]:如何使用程序卸载一个已经加载的.ARX程序?

最初由 robot 发布
[B]刚刚学习ObjectARX编程,遇到一个问题“如何卸载一个已经加载的.ARX程序?”
我想解决的方法有三种:
一、在AutoCAD中调用Appload命令卸载已经加载的程序;
二、使用所加载程序中自身的卸载命令;
三、调用第三个... [/B]


使用:
[php]
AcRxDynamicLinker::unloadApp Function virtual bool

unloadApp(

const char * appName,

bool asCmd = false) = 0;

appName Input null-terminated string which is the application name (as

set in the system registry) of the ObjectARX module to unload

asCmd Input Boolean indicating whether to unload the application as if by

user command

This function unloads the appName ObjectARX program. appName is the
application name as set in the operating system registry. If the ObjectARX
application was not loaded via the AcRxDynamicLinker::loadApp() or
acrxLoadApp() methods or through the demand loading mechanism (all of
which use the system registry entry for the application), then this function
will be unable to unload the application.
When asCmd is kFalse, it's possible to call this method more than once
and still get a successful return value. This method will simply decrement
the reference count for the application.
Note The asCmd value used for unloadApp() must be the same as the
one used for loadApp().

The function returns true if the module was successfully unloaded;
otherwise, it returns false.

[/php]

[php]
AcRxDynamicLinker::unloadModule Function virtual bool

unloadModule(

const char* fileName,

bool asCmd = false) = 0;

fileName Input null-terminated string which is the file name of the program
to unload
asCmd Input Boolean indicating whether to unload the application as if by
user command

This function unloads the ObjectARX module filename. Before physically
unloading the module, the application's acrxEntryPoint() function is called
with the kUnloadAppMsg message to allow it to perform cleanup.
Notification is also sent about the impending unload.


Note The fileName string is case and path sensitive, so it must be either
exactly the same as string that was used to load the application or it must
be the same as the string returned by the ads_arxloaded() function.


When asCmd is kFalse, it's possible to call this method more than once
and still get a successful return value. This method will simply decrement
the reference count for the application.

Note The asCmd value used for unloadModule() must be the same as the
one used for loadModule().
[/php]
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

发表于 2004-5-31 09:11:40 | 显示全部楼层
if (!acrxLoadModule("test.dbx", false))
                        return AcRx::kRetError;
acrxUnloadModule("test.dbx");
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

 楼主| 发表于 2004-6-1 17:48:11 | 显示全部楼层
谢谢了,我自己这两天也找了一下。好像下面这段也行,请大家指点指点
void vcunload()
{
        // TODO: Implement the command
        char* ads_appname="abc.arx";       
        struct resbuf *rb1, *rb2;
        for (rb2 = rb1 = acedArxLoaded(); rb2 != NULL; rb2 = rb2->rbnext)
        {
                if (rb2->restype == RTSTR)
                        acutPrintf("%s\n", rb2->resval.rstring);
        }acutRelRb(rb1);
        for (rb2 = rb1 = acedArxLoaded(); rb2 != NULL; rb2 = rb2->rbnext)
        {
                if (strcmp(ads_appname, rb2->resval.rstring) != 0)
                        acedArxUnload(rb2->resval.rstring);
        }acutRelRb(rb1);
       
}
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|申请友链|Archiver|手机版|小黑屋|辽公网安备|晓东CAD家园 ( 辽ICP备15016793号 )

GMT+8, 2024-9-21 17:37 , Processed in 0.252860 second(s), 37 queries , Gzip On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表