To experienced VB programmers - Out of Process ActiveX EXE

To experienced VB programmers - Out of Process ActiveX EXE

Anonymous
Not applicable
442 Views
3 Replies
Message 1 of 4

To experienced VB programmers - Out of Process ActiveX EXE

Anonymous
Not applicable
I have an application witch is made of 5 DLLs that all reference a helper ActiveX DLL. Right now, this has the drawback to create 5 instances of my helper ActiveX DLL (or 5 instances of `my GlobalMultiUse classin the dll).

But I now want to store the info of my User in this ActiveX so that all my DLLs can refer to this User object to check the authentification state of the current user. But for this to work, I must have only one instance of my User object. But how do I expose and access an object from an ActiveX EXE that would be static to memory (thus the exe would continue running) untill I am done with it? Optimally, I would also like my User object to be present (or accessible) from a Global class in my ActiveX EXE.

Is this possible?

Any help or input would be appreciated.
Thx in advanced...
0 Likes
443 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable
this is probably way too obvious for you to not have already known...but
just in case....
(I'm WAY not an experienced programmer 🙂 but it sounds like the famous
singleton pattern, no?)
Can the ax not have a function to return the helper object?
Private moHelperObject as dll.class

Public Function GetHelper()as HelperObject
If moHelperObject is Nothing then
Set moHelperObject = CreateHelperObject()
End if
Set GetHelper = moHelperObject
End Function
'that way it's only created once and reused after that???
hth
Mark

wrote in message news:5794299@discussion.autodesk.com...
I have an application witch is made of 5 DLLs that all reference a helper
ActiveX DLL. Right now, this has the drawback to create 5 instances of my
helper ActiveX DLL (or 5 instances of `my GlobalMultiUse classin the dll).

But I now want to store the info of my User in this ActiveX so that all my
DLLs can refer to this User object to check the authentification state of
the current user. But for this to work, I must have only one instance of my
User object. But how do I expose and access an object from an ActiveX EXE
that would be static to memory (thus the exe would continue running) untill
I am done with it? Optimally, I would also like my User object to be
present (or accessible) from a Global class in my ActiveX EXE.

Is this possible?

Any help or input would be appreciated.
Thx in advanced...
0 Likes
Message 3 of 4

Anonymous
Not applicable
Yep... and I got it to work.

My problem was to make it so that the ActiveX EXE would only start once and all DLLs would attach themselfs to the same instance of the EXE. Witch I have done, and my problem resided in the properties of the VB project and the use of a Global class in the EXE. Now any of my DLLs can access the MyUserObject without instancing anything and if any DLL makes a change to one of the propertie's value of the User object, every one has acces to this value change.

Unfortunatly, this ActiveX EXE has slowed donw my app alot (because of marshalling), so I'll be working on this for the next few days. But other than that, everything works great.

Thanks for the input.
0 Likes
Message 4 of 4

Anonymous
Not applicable
wrote in message news:5795231@discussion.autodesk.com...
Yep... and I got it to work.

>My problem was to make it so that the ActiveX EXE would only start once


how did you do that? app.PrevInstance?

>and all DLLs would attach themselfs to the same instance of the EXE.

> Now any of my DLLs can access the MyUserObject without instancing anything

How? , if you care to share what you found to work...

> and if any DLL makes a change to one of the propertie's value of the User
> object, every one has acces to this value change.

>Unfortunatly, this ActiveX EXE has slowed donw my app alot (because of
>marshalling),


>Thanks for the input.


Well, you're far more advanced than I but I'm glad if I was of any small
help.
Without knowing anything about what your app does..., what is the advantage
of using an AXexe over just using a AXdll which you can inject into acad's
process to avoid the marshalling cost?

I haven't yet delved into active x exes so have very little understanding of
their advantages
(since almost all my work is for acad and dlls can run in process I haven't
learned where axexe are better suited)

Mark
0 Likes