Message 1 of 3
Application object in ActiveX DLL

Not applicable
10-24-2001
11:35 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I know this question or a very similar one has been asked here before, but I thought
perhaps some new information might be available.
When you create an ActiveX DLL, it has an implicit Application object (presumably the
ActiveX client into which the DLL is loaded). This relationship seems to break down
somewhat when multiple sessions of AutoCAD are running, however.
For example, I have an ActiveX DLL (created with VB6) which contains some utility
functions. I reference this DLL from several VBA projects. If I run one of these VBA
macros in one session of AutoCAD, the prompts from my utility functions (contained in the
DLL) show up in another session.
If I create a property in my DLL to hold a reference to an instance of AcadApplication and
then initialize it manually by passing Application from my VBA project, the problem goes
away.
'In my class module
Private objApp As AcadApplication
Public Property Set Application (ByRef Application as AcadApplication)
Set objApp = Application
End Property
'In my VBA macro
Dim objUtil As New Utility
Set objUtil.Application = Application
It seems kind of backward to do this, since a default Application object is provided to
the DLL.
If anyone has any insight into why this behavior occurs, it would be greatly appreciated.
Thanks,
Chuck Gabriel
Coggin Carrara, Inc.
perhaps some new information might be available.
When you create an ActiveX DLL, it has an implicit Application object (presumably the
ActiveX client into which the DLL is loaded). This relationship seems to break down
somewhat when multiple sessions of AutoCAD are running, however.
For example, I have an ActiveX DLL (created with VB6) which contains some utility
functions. I reference this DLL from several VBA projects. If I run one of these VBA
macros in one session of AutoCAD, the prompts from my utility functions (contained in the
DLL) show up in another session.
If I create a property in my DLL to hold a reference to an instance of AcadApplication and
then initialize it manually by passing Application from my VBA project, the problem goes
away.
'In my class module
Private objApp As AcadApplication
Public Property Set Application (ByRef Application as AcadApplication)
Set objApp = Application
End Property
'In my VBA macro
Dim objUtil As New Utility
Set objUtil.Application = Application
It seems kind of backward to do this, since a default Application object is provided to
the DLL.
If anyone has any insight into why this behavior occurs, it would be greatly appreciated.
Thanks,
Chuck Gabriel
Coggin Carrara, Inc.