Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21197

How to make AutoCAD instance only available to my application?

$
0
0
Hey all,

I've been working with integrating AutoCAD into my VB6 Projects. I imagine that my question is not specific to AutoCAD, but that just happens to be what I'm using.

So, when I start my program, I create an instance of AutoCAD that can be accessed throughout my entire code. When the program finished, it terminates this instance.
Now, while the program is running, if I start up AutoCAD manually by opening a drawing file, it chooses the instance my VB6 Project created and makes it visible.

When I start up AutoCAD manually by double-clicking the exe, then a second (and independent) instance is generated (this is the behavior I desire!).

So... my question is this:
Is there a way my VB6 Project can hold an instance of AutoCAD that NO OTHER application can access? In other words, make the instance private to my application only?

The reason I wish to do this is because when I do open a AutoCAD drawing manually, and then close it manually, it ends the instance my VB6 Project created! Not good! :(
This will always make the program crash since it is referencing this terminated instance of AutoCAD. I know there are ways to check if the instance is valid, then re-create if it's not, but this puts more delay on the program (rather than loading it once and keeping it). Doing this requires error checking for each time I need to start using AutoCAD again in my application.

I know that it's probably a good idea to error-check anyways, and that the user can still terminate this instance by going to Task Manager; however, if that happens I'd rather let the program crash (this application is only going to be used internally).


I appreciate all of your help! :)

God Bless,
-Nick

Viewing all articles
Browse latest Browse all 21197

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>