TheSwamp

Code Red => .NET => Topic started by: mohnston on July 05, 2006, 02:03:15 PM

Title: Autoload .NET dll
Post by: mohnston on July 05, 2006, 02:03:15 PM
Is there no way to automatically load a .NET dll when AutoCAD starts?
How about demand load?

I mean, other than LISP.

Title: Re: Autoload .NET dll
Post by: Bobby C. Jones on July 05, 2006, 02:14:25 PM
Is there no way to automatically load a .NET dll when AutoCAD starts?
How about demand load?

I mean, other than LISP.


.NET assemblies can be demand loaded just like ARX modules.  Just make sure to set the managed flag.

Code: [Select]
HKEY_LOCAL_MACHINE\SOFTWARE\Autodesk\AutoCAD\<releaseNum>\
    ACAD-<VersionId>:<LocalID>\
        Applications\
            <ApplicationName>\
                DESCRIPTION:REG_SZ:<User Friendly Application Name>
                LOADCTRLS:REG_DWORD:<acrxAppLoadReason>
                LOADER:REG_SZ:<FullyQualifiedFileName>
                MANAGED:REG_DWORD:<ManagedFlag>
                Commands\
                    <GlobalCommandName>:REG_SZ:<LocalCommandName>
                    …
                Groups\
                    <GroupName>:REG-SZ:<GroupName>
                    …
Title: Re: Autoload .NET dll
Post by: mohnston on July 05, 2006, 03:52:18 PM
So I have to touch the users registry to make sure that my dll has the managed flag set? Maybe I could do that with a function in VBA.

How do I demand load my dll?
Title: Re: Autoload .NET dll
Post by: Atook on July 05, 2006, 05:41:41 PM
For startup loading, I think you could just add it to the startup suite.

Not sure about demand loading though.
Title: Re: Autoload .NET dll
Post by: mohnston on July 05, 2006, 05:48:50 PM
That would be too logical.   :?
You cannot select a dll file to add to startup suite. But that is exactly the functionality I'm looking for.
Title: Re: Autoload .NET dll
Post by: Kerry on July 05, 2006, 05:53:53 PM
If you don't want to use the registry .. perhaps load the dll with lisp ;

(command "NETLOAD" .... etc )

called from a .mnl associated with a partial menu, or somesuch.
Title: Re: Autoload .NET dll
Post by: Atook on July 05, 2006, 06:53:15 PM
I'm new to the whole .NET thing, but can't you just change the DLL filename from mynet.dll to mynet.arx?

It was my understanding from the 1st .NET lab that an ARX & DLL are the same, you just need to set the file name to mynet.arx in the compile settings.

Please explain if I'm wrong, I'm still trying to pick this stuff up.
Title: Re: Autoload .NET dll
Post by: MickD on July 05, 2006, 06:58:49 PM
AutoCAD looks for an 'arx' filename extention when loading then it looks for the entry point with the correct loading (exported) functions etc. This way you can only ever load a dll with the .arx extension. When loading .net dll's it looks into the .net assembly for the entry point and proper protocol for loading.
Title: Re: Autoload .NET dll
Post by: Bobby C. Jones on July 10, 2006, 10:13:40 AM
How do I demand load my dll?
You demand load it by setting the registry keys in my previous post.  The attached image shows some of the keys for the acLayer assembly, the Layer Manager dialog.