.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Is this a bug??

3 REPLIES 3
Reply
Message 1 of 4
Anonymous
260 Views, 3 Replies

Is this a bug??

Hi all,

I am trying to load .dll application using windows registry.
the applicaion doesn't load till i luanch to autocad twice???!!!

The following is the registry:

\\HKEY_LOCAL_MACHINE\SOFTWARE\Autodesk\AutoCAD\R16.2\ACAD-4001:409\Applications\MyApp
DESCRIPTION REG_SZ Loads My Application
LOADCTRLS REG_DWORD 0x02
LOADER REG_SZ C:\MyApp.dll
MANAGED REG_DWORD 0x01

BTW, the application implements IExtensionApplication that means i am not invocing a command to load it.

the attached are the command line when i am lunching to autocad once and second.

Can anybody tells me what is the problem that leads me to lunch autocad twice to load the application??

Sorry for my bad english.

Noora
3 REPLIES 3
Message 2 of 4
Anonymous
in reply to: Anonymous

It Seems no solution for this problem??
Message 3 of 4
Anonymous
in reply to: Anonymous

I know where the problem is located 🙂

As I said that i am implementing IExtensionApplication in my application.

and to implement this class, i defined the following function as

public virtual void Initialize()
{
//
//My Code
//
AcadApp=(Autodesk.AutoCAD.Interop.AcadApplication)Marshal.GetActiveObject("AutoCAD.Application.16.2");
}

It seems that i can't lunch to autocad and autoload this application using windows registry while the initialize function has the mentioned statment.

When I removed that statment from Initialize function and located it in another place the autoloading works.

but still don't know why?
Message 4 of 4
cgay
in reply to: Anonymous

Nawara17,

You should never need to do what you are doing.

Change what you have to:
[code]
AcadApp = Autodesk.AutoCAD.ApplicationServices.Application
[/code]
This gives the Managed AutoCAD application object.

The reason it is failing your way is that you are trying to use COM to return an AutoCAD object, but that object is not fully initialized when you try to acquire it, resulting in a COM exception (time out) 'Failed to (create/acquire) object" or something like that.

If you need the COM AutoCAD application object, then use this :
[code]
AcadApp = (Autodesk.AutoCAD.Interop.AcadApplication) Autodesk.AutoCAD.ApplicationServices.Application.AcadApplication
[/code]

C

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost