.NET

Reply
Active Contributor
dwolfe01
Posts: 29
Registered: ‎05-14-2008
Message 11 of 13 (208 Views)

Re: Install toolbar CUI.NET API

04-08-2009 11:24 AM in reply to: jgarciaanton
Can someone elaborate on this? I'm doing a similar thing (create an installation setup).

I've got all the information I need from the registry (cui location, program install path location), but I don't know how point my solution to allow looking in the local AutoCAD install folder for the AcCui.dll (and the others).

I'm using C# and I am not sure how to implement the SetDllDirectoryA function from VB.

Any clues?
*Expert Elite*
GTVic
Posts: 917
Registered: ‎09-07-2004
Message 12 of 13 (208 Views)

Re: Install toolbar CUI.NET API

04-08-2009 11:47 AM in reply to: jgarciaanton
There was a free 2010 CUIX API webcast course recently. It has not yet been posted for download but there are others available. Here is the link.

http://www.adskconsulting.com/adn/cs/api_course_sched.php
Active Contributor
dwolfe01
Posts: 29
Registered: ‎05-14-2008
Message 13 of 13 (208 Views)

Re: Install toolbar CUI.NET API

04-09-2009 12:30 PM in reply to: jgarciaanton
I emailed Wayne Brill about this since it (modifying a cui outside of AutoCAD) wasn't covered in the presentation. Here's the response (an excerpt from a previous case).
It is not legal to ship the AutoCAD specific DLL’s with your application. But you may copy the already installed CUI DLL’s on a machine into your applications installation directory during the installation process. That is the machine must have AutoCAD installed on it.

I am not sure if it is compulsory for you to go with the standalone approach but I would like to put forth some of the comments that came up during the discussion with my colleagues regarding this case. Although, it is mentioned that you can build standalone applications looks like it is not a good idea and the reasons being:

1. As I mentioned above, developers aren’t permitted to ship the CUI DLL’s with their applications, so that rules out installing CUI DLL’s with your application.
(Maybe a workaround to this would be for the installer to copy the already installed CUI DLL on a machine into its install directory, but that's messy)

2. The CUI DLL resides in the AutoCAD install directory, but is not a strong named assembly, so has no entry in the GAC. Therefore, to use it the developer must either
a. Run his executable from the AutoCAD install directory.

b. Dynamically find and load the CUI DLL at runtime
You may want to take a look at the following solution in MSDN:
How to load an assembly at runtime that is located in a folder that is not the bin folder of the application
http://support.microsoft.com/kb/837908

c. Have a hard coded dependency on a specific location for the CUI DLL. This then assumes AutoCAD is installed in the default directory.
System.IO.Directory.SetCurrentDirectory();

Of the above installing in the AutoCAD directory is probably the best.

Dynamically find and load the CUI DLL at runtime [would be] the best option if it worked. Unfortunately, it seems that .exe directory is hard-coded when AcCustomize.dll is loaded from AcCUI.dll. Even if AcCustomize.dll is already loaded, the FileNotFoundException is thrown if exe_dir\AcCustomize.dll is not found.
Please record this issue as a Change Request.
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.