AUTOCAD的注册表详解

2007-08-24 16:19:51 来源:模具网   
 - Overview.

The AutoCAD registry is composed of three main sections. The HKEY_CLASS_ROOT

section contains all the information for the ActiveX automation, as well as file

descriptor. This section does not need in any case and at any time to be

modified by a third party application. This section is and must stay

instanciated by the AutoCAD installer. However, in Mechanical Desktop and

AutoCAD r14.01, there is a bug in the installer which can cause problem for the

Automation part. This bug (and solution will be described later in that

document).

For the two other sections, we have to be careful on which system and

configuration the user is working on. Windows 95/98 differ from Windows NT in

term of permission per user, to allow access to the registry at a given user.

But in short, the HKEY_LOCAL_MACHINE section contains all the default

information AutoCAD needs to initialized itself for a new NT login user, as well

it contains the ARX applications demand loading information.

On another hand, the HKEY_CURRENT_USER contains the default settings and

profiles for a given NT login user. (note that Windows 95/98 has only one common

login user).

- HKEY_CLASS_ROOT.

As said before, you should not manipulate or modify that section yourself.

Except for fixing the AutoCAD r14.01 installer bug, in case it occurs on your

computer. Most of the time that bug does not show, or is not showing up on a

target computer, because the AutoCAD ActiveX server is not used. But to fix the

problem, you just need to apply the following .REG file on the computer, or to

integrate the needed changes in your installer.

>>>>>>>>>>>>>

REGEDIT

HKEY_CLASSES_ROOT\Interface\{372FA490-600C-11CF-93EB-0800099EB3B7} =

IAcadApplication

HKEY_CLASSES_ROOT\Interface\{372FA490-600C-11CF-93EB-0800099EB3B7}\TypeLib =

{9B5492B0-EC9A-11CE-935A-0800099EB3B7}

HKEY_CLASSES_ROOT\Interface\{9B5492B1-EC9A-11CE-935A-0800099EB3B7} =

IAcadDocument

HKEY_CLASSES_ROOT\Interface\{9B5492B1-EC9A-11CE-935A-0800099EB3B7}\TypeLib =

{9B5492B0-EC9A-11CE-935A-0800099EB3B7}

HKEY_CLASSES_ROOT\Interface\{24B8A4E0-432A-11D0-A893-0800091B9B14} =

IAcadPreferences

HKEY_CLASSES_ROOT\Interface\{24B8A4E0-432A-11D0-A893-0800091B9B14}\TypeLib =

{9B5492B0-EC9A-11CE-935A-0800099EB3B7}

<<<<<<<<<<<<

- HKEY_LOCAL_MACHINE

The entry key in that section for AutoCAD is located at:

HKEY_LOCAL_MACHINE\Software\Autodesk\AutoCAD\R14.0\

Under that key, you will find a value named 'CurVer' which contains the last

installed and default AutoCAD identifier in form of:

ACAD-nnnnnnn:nnnnnnnn

This identifier is used to identify a given AutoCAD on a platform where there is

multiple AutoCAD installed. Having that identifier, you can easily find out

which AutoCAD will be used by the system, in case you double-click on a DWG

file, or if you launch AutoCAD via an ActiveX client executable.

However, it does not mean this will always be that AutoCAD which is going to be

used every time. A user can launch AutoCAD from the 'Start Menu', and then this

identifier is useless. For your information, an ObjectARX application can

retrieve the used identifier with the 'acrxProductKey()' function.

Ok. Having that identifier, we can now go further in the AutoCAD registry

structure. So under key:

HKEY_LOCAL_MACHINE\Software\Autodesk\AutoCAD\R14.0\\

you will find some other values which are used by AutoCAD to create the AutoCAD

HKEY_CURRENT_USER entries when a new login user start AutoCAD the first time.

Note that the AutoCAD installer does not create anything in the

HKEY_CURRENT_USER section at installation time, and so needs the followings

entries to be able to initialize itself at startup. We will see later that it is

important for your application to do this as well.

So here is the list of value, their type and their usage:

ACAD - STRING - "Default AutoCAD search PATH"

AcadLocation - STRING - "ACAD.EXE path"

LangAbbrev - STRING - "Language of the installed AutoCAD (2 letters code)"

Language - STRING - "Language of the installed AutoCAD"

LocaleId - STRING - "Microsoft Language identification code"

NetSupport - STRING - "ADLM support (ie: solution 19475)"

ProductId - STRING - "Product ID"

ProductName - STRING - "Product Name"

Release - STRING - "Release"

SerialNumber - STRING - "Serial Number"

VBAComponents - DWORD - Microsoft VBA components (reserved)

VBALanguage - DWORD - Microsoft Language identification code

VBAVersion - DWORD - Microsoft VBA version (reserved)

The only interesting value is ACAD, and at least this is the only one used by

AutoCAD to create a new login user HKEY_CURRENT_USER section when started the

first time.

The 'Applications' sub-section contains the ARX application demand loading

information. This section should be the only section your application (or

installer) should modify. Here is the structure, you should follow:

HKEY_LOCAL_MACHINE\Software\Autodesk\AutoCAD\R14.0\\Applications\

key: MyApp\

value: LOADCTRLS - DWORD - Demand load type

value: REGPATH - STRING - "PATH in the registry to the application registry

section"

Sample:

DcgApplication\

LOADCTRLS - 0x02

REGPATH - "\\HKEY_LOCAL_MACHINE\Software\DcgCompany\DcgApplication"

The LOADCTRLS may be a bit wise or'd combination of any of the following:

kOnProxyDetection = 0x01, load the ARX application when objects of custom

classes it

controls are loaded via drawing open, dxfin,

insert, etc.

kOnAutoCADStartup = 0x02, load the ARX application when AutoCAD starts up

kOnCommandInvocation = 0x04, load the ARX application whenever an unknown

command is executed

that it has a registry entry for

kOnLoadRequest = 0x08, allow loading of the ARX application via the

AcRxDynamicLinker::loadApp() method

kLoadDisabled = 0x10 do not demand load the ARX application for any

reason

The other sub-sections like 'AutodeskApps' and 'Reinstall' should not be

modified by a third party. But the 'AutodeskApps' sub-section is useful to help

you understanding the structure you need to implement for demand loading of your

ARX application as it contains the demand load information for the Autodesk ARX

application for demand load. Here is a short summary of what you need:

key: Commands\

value: InternationalCmd - STRING - "LocalizedCmd"

... other commands ...

key: Groups\

value: GroupName - STRING - "GroupName"

key: Loader\

value: MODULE - STRING - "Full PATHNAME to the ARX file on the hard-drive"

key: Name\

value: AppName - STRING - "Description string"

Sample:

HKEY_LOCAL_MACHINE\Software\DcgCompany\DcgApplication\Commands\

_MYCOMMAND - "MACOMMANDE"

_MY2NDCMD - "MA2NDCMD"

HKEY_LOCAL_MACHINE\Software\DcgCompany\DcgApplication\Groups\

DCGGROUP - "DCGGROUP"

HKEY_LOCAL_MACHINE\Software\DcgCompany\DcgApplication\Loader\

MODULE - "c:\Program Files\DcgCompany\DcgApplication\DcgApp.arx"

HKEY_LOCAL_MACHINE\Software\DcgCompany\DcgApplication\Name\

DcgApp - "This is my favorite Dcg Application"

In R14.x releases the group sub-section is not used, but it will be in future.

The Commands sub-section is used only if the application is registered for

demand loading on command invocation. And the Name sub-section is used only if

the application is registered for demand loading in load request.

- HKEY_CURRENT_USER

The HKEY_LOCAL_MACHINE seen before, can be manipulated at installation or 

running time by a third party. But his is possible only if the login user has

the right permissions to do this. Most of the time, if using the correct

settings, anybody can read and write in that section. For the HKEY_CURRENT_USER

section this is the same. However, that section is accessible only by the login

user, and might not be accessible at installation time by the computer

administrator or example.

This restriction applies only for NT users, as Windows 95/98 does not have the

multiple user feature. But as AutoCAD runs on all above platform, your

applications should work fine on all of them as well.

So to work on all platform, and to be sure your application will work fine for a

new NT login user, your installer should create entries in the

HKEY_LOCAL_MACHINE only. And you application should be able to initialize itself

at startup time using these entries to create and/or modify the AutoCAD entries

and profiles (ie solutions 1583, and 1564).

A complete description of the HKEY_CURRENT_USER section is useless as that

section contains many information about editor settings and configurations.

The two main interests is that 'Profiles' are defined in that section. The

default profile used by AutoCAD is coded in the default value of:

HKEY_CURRENT_USER\Software\Autodesk\AutoCAD\R14.0\\Profiles

and that you should not modify these information directly in the registry while

AutoCAD is running because then they will not be synchron with the ones AutoCAD

has loaded when started. Instead, when AutoCAD is running you can use the

ActiveX 'preferences' object to make some changes (ie solution 1583)

- Sample

On the ADN CD, and ADN WEB Site, Developer Consulting Group has written a sample

named 'DdModify' (command 'DCMOD') which implements an installer and an ARX-MFC

application which demonstrates all what I have said in that document. I strongly

suggest you to have a look to it...

To summarize that sample, the installer install the ARX application on the

hard-drive and register it for demand loading on command invocation. And the ARX

application initializes itself the first time it is loaded in a given AutoCAD

for a given Windows login user, and a given AutoCAD profile.

HKEY_CLASSES_ROOT\Interface\{372FA490-600C-11CF-93EB-0800099EB3B7}\ProxyStubClsi

d = {00020424-0000-0000-C000-000000000046}

HKEY_CLASSES_ROOT\Interface\{372FA490-600C-11CF-93EB-0800099EB3B7}\ProxyStubClsi

d32 = {00020424-0000-0000-C000-000000000046}

HKEY_CLASSES_ROOT\Interface\{9B5492B1-EC9A-11CE-935A-0800099EB3B7}\ProxyStubClsi

d = {00020424-0000-0000-C000-000000000046}

HKEY_CLASSES_ROOT\Interface\{9B5492B1-EC9A-11CE-935A-0800099EB3B7}\ProxyStubClsi

d32 = {00020424-0000-0000-C000-000000000046}

HKEY_CLASSES_ROOT\Interface\{24B8A4E0-432A-11D0-A893-0800091B9B14}\ProxyStubClsi

d = {00020424-0000-0000-C000-000000000046}

HKEY_CLASSES_ROOT\Interface\{24B8A4E0-432A-11D0-A893-0800091B9B14}\ProxyStubClsi

d32 = {00020424-0000-0000-C000-000000000046}

(责任编辑:小编)
下一篇:

DMC2024打造上下游互联互通大平台,线上线下多渠道宣传创造更多商机

上一篇:

AutoCAD 技巧一则

  • 信息二维码

    手机看新闻

  • 分享到
免责声明
• 
本文仅代表作者个人观点,本站未对其内容进行核实,请读者仅做参考,如若文中涉及有违公德、触犯法律的内容,一经发现,立即删除,作者需自行承担相应责任。涉及到版权或其他问题,请及时联系我们