找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 530|回复: 3

如何用其他程序启动CAD并加载arx程序同时打开dwg文件

[复制链接]
发表于 2006-2-18 10:22:05 | 显示全部楼层 |阅读模式

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

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

×
请高手指点!
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
发表于 2006-2-28 22:36:57 | 显示全部楼层
在启动目录在创建一个ACAD.RX文本文件,里面写上要加载的ARX文件名,每个文件占一行!

        STARTUPINFO si = {0};
    si.cb = sizeof(si);
        PROCESS_INFORMATION pi;
        BOOL bRetVal;

        bRetVal = CreateProcess("AutoCAD可执行文件所在路径 '同时打开dwg文件名'", NULL, NULL, NULL, FALSE, 0, NULL,
                                                        "启动目录:ARX文件所在路径", &si, &pi);

        if (!bRetVal)
        {
                AfxMessageBox("启动CAD失败!");
        }
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

发表于 2006-3-26 16:42:42 | 显示全部楼层
用VB的方式要简单些!
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

发表于 2006-3-27 23:20:26 | 显示全部楼层
用Vc也很简单
自动加载arx程序

AcadApp::ErrorStatus

acrxRegisterApp(

AcadApp::LoadReasons alr,

const char * logicalName,

const char * regPath,

int regkeyindex,

bool bDwgU = false);

alr Input load reason (or multiple, logically ORd load reasons) that should apply to the application. If multiple load reasons are logically ORd, the result must be cast to the type AcadApp::LoadReasons.
logicalName Input logical name for ObjectARX or ObjectDBX program to load
regPath Input registry path to where the application's demand load information is located
regkeyindex Input index of rootkey string to prepend to regPath
bDwgU Input Boolean indicating whether to register the application under the Autodesk/ObjectDBX area of the registry

This function will make an entry in the "Applications" subkey tree of AutoCAD's section of the HKEY_LOCAL_MACHINE part of the system registry. The entry's key will be logicalName and will have two subkeys for each of the values reasons and regPath.

regPath should be a path in the system registry to where your application-specific command demand load entries, path and file name of your ObjectARX application, and logical name for your application are located. It must not include the rootkey since that will be prepended based on the reKeyIndex value. logicalName will be appended onto the end of regPath before writing it to the registry.

regkeyIndex is an index indicating which of the following root key strings will be prepended to regPath before writing it into the registry as the string entry for the regPath subkey value under the logicalName key:

0 for the string "\\\\HKEY_CLASSES_ROOT"

1 for the string "\\\\HKEY_CURRENT_USER"

2 for the string "\\\\HKEY_LOCAL_MACHINE"

3 for the string "\\\\HKEY_USERS"

For example, if AutoCAD's section is:

HKEY_LOCAL_MACHINE
    SOFTWARE
        Autodesk
            AutoCAD
                R14.0
                      ACAD-606348324:606348324then

acrxRegisterApp((AcadApp::LoadReasons)(AcadApp::kOnProxyDetection |
AcadApp::kOnCommandInvocation), "TestApp", "SOFTWARE\\MyApps", 2);

will result in the following:

HKEY_LOCAL_MACHINE
    SOFTWARE
        Autodesk
            AutoCAD
                R14.0
                    ACAD-606348324:606348324
                        Applications
                            TestApp
                                LOADCTRLS: REG_DWORD: 0X5
                                REGPATH: REG_SZ: \\HKEY_LOCAL_MACHINE\SOFTWARE\MyApps\TestAppand AutoCAD will expect to find "Commands", "Loader", and "Name" keys with entries under them at \\HKEY_LOCAL_MACHINE\SOFTWARE\MyApps\TestApp. For example, such a subtree might look like:

HKEY_LOCAL_MACHINE
    SOFTWARE
        MyApps
            TestApp
                Commands
                    DOIT: REG_SZ: DOIT
                    MOVEME: REG_SZ: MOVEME
                Loader
                    MODULE: REG_SZ: MyTestApp.arx
                Name
                    TestApp
                Groups
                    GRPNAME: REG_SZ: GRPNAMEIf bDwgU is true, the application will be registered under the Autodesk/ObjectDBX area of the registry. In addition to AutoCAD, all ObjectDBX applications can search for it there.

Returns AcadApp::eOk if successful.

Returns AcadApp::eKeyExists if an entry already exists and cannot be overwritten.

Returns AcadApp::eRejected if the write could not be completed.

Include File
rxregsvc.h
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-9-23 08:19 , Processed in 0.204941 second(s), 38 queries , Gzip On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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