.NET

Reply
Valued Contributor
Nawara17
Posts: 52
Registered: ‎03-27-2006
Message 1 of 4 (120 Views)

Is this a bug??

120 Views, 3 Replies
11-18-2006 08:13 AM
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
Valued Contributor
Nawara17
Posts: 52
Registered: ‎03-27-2006
Message 2 of 4 (120 Views)

Re: Is this a bug??

11-18-2006 01:34 PM in reply to: Nawara17
It Seems no solution for this problem??
Valued Contributor
Nawara17
Posts: 52
Registered: ‎03-27-2006
Message 3 of 4 (120 Views)

Re: Is this a bug??

11-19-2006 04:41 AM in reply to: Nawara17
I know where the problem is located :smileyhappy:

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?
Distinguished Contributor
cgay
Posts: 125
Registered: ‎08-02-2005
Message 4 of 4 (120 Views)

Re: Is this a bug??

11-19-2006 03:48 PM in reply to: Nawara17
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
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!