Author Topic: Autoload .NET dll  (Read 6451 times)

0 Members and 1 Guest are viewing this topic.

mohnston

  • Bull Frog
  • Posts: 305
  • CAD Programmer
Autoload .NET dll
« 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.

It's amazing what you can do when you don't know what you can't do.
CAD Programming Solutions

Bobby C. Jones

  • Swamp Rat
  • Posts: 516
  • Cry havoc and let loose the dogs of war.
Re: Autoload .NET dll
« Reply #1 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>
                    …
Bobby C. Jones

mohnston

  • Bull Frog
  • Posts: 305
  • CAD Programmer
Re: Autoload .NET dll
« Reply #2 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?
It's amazing what you can do when you don't know what you can't do.
CAD Programming Solutions

Atook

  • Swamp Rat
  • Posts: 1029
  • AKA Tim
Re: Autoload .NET dll
« Reply #3 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.

mohnston

  • Bull Frog
  • Posts: 305
  • CAD Programmer
Re: Autoload .NET dll
« Reply #4 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.
It's amazing what you can do when you don't know what you can't do.
CAD Programming Solutions

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Autoload .NET dll
« Reply #5 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.
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Atook

  • Swamp Rat
  • Posts: 1029
  • AKA Tim
Re: Autoload .NET dll
« Reply #6 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.

MickD

  • King Gator
  • Posts: 3636
  • (x-in)->[process]->(y-out) ... simples!
Re: Autoload .NET dll
« Reply #7 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.
"Programming is really just the mundane aspect of expressing a solution to a problem."
- John Carmack

"Short cuts make long delays,' argued Pippin.”
- J.R.R. Tolkien

Bobby C. Jones

  • Swamp Rat
  • Posts: 516
  • Cry havoc and let loose the dogs of war.
Re: Autoload .NET dll
« Reply #8 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.
Bobby C. Jones