|
-
Feb 18th, 2013, 01:50 PM
#1
Thread Starter
Junior Member
[RESOLVED] ActiveX DLL- Include common Subs/Functions that should not need Object Instantiation
Hey all,
What I'm trying to do is store some common Subs/Functions (that I would put in a Module) inside of an ActiveX DLL so that I can reuse the code for all of my applications.
I was hoping not to do Object instantiation because some of the Functions return Objects (and act like Constructors). Also I have some other functions/subs that should not require instantiation as they only work with the arguments passed on to them.
Anyways, I was trying to include a Module in the DLL I'm working on, yet it doesn't have scope outside of the DLL. That is... my applications cannot call the functions inside it.
I'm not exactly sure that making an ActiveX DLL is the correct route I want to go.
Ultimately, I'm trying to call a Function/Sub as if it was included in the application's project that I intend to use it in... Except, I don't want to re-type it into every application that needs the use the Function/Sub.
Your help is greatly appreciated! 
God Bless,
-Nick
-
Feb 18th, 2013, 02:22 PM
#2
Thread Starter
Junior Member
Re: ActiveX DLL- Include common Subs/Functions that should not need Object Instantiat
I found another thread with the same issue:
http://www.vbforums.com/showthread.p...nother-project
It seems these Functions/Subs will indeed need to be in an Object that is instantiated.
So, I believe the most elegant way of doing this is to create a Class Module that store all these common Functions/Subs, then instantiate it once as a global variable in my projects.
Please let me know if you find anything to the contrary. I'd realy like to achieve the originally mentioned functionality.
EDIT: I was able to do the desired by creating a Module and Class Module with the same functions. The Module so that the Functions can be used by other Classes in the DLL. The Class Module so that the Functions are visible outside of the DLL (instancing = GlobalMultiUse).
Still looking for a better solution as it seems pointless to have both a Module and Class Module with duplicate contents.
Last edited by Millerni456; Feb 18th, 2013 at 02:42 PM.
-
Feb 18th, 2013, 02:40 PM
#3
Re: ActiveX DLL- Include common Subs/Functions that should not need Object Instantiat
On Local Error Resume Next: If Not Empty Is Nothing Then Do While Null: ReDim i(True To False) As Currency: Loop: Else Debug.Assert CCur(CLng(CInt(CBool(False Imp True Xor False Eqv True)))): Stop: On Local Error GoTo 0
Declare Sub CrashVB Lib "msvbvm60" (Optional DontPassMe As Any)
-
Feb 18th, 2013, 02:50 PM
#4
Thread Starter
Junior Member
Re: ActiveX DLL- Include common Subs/Functions that should not need Object Instantiat
Hey Bonnie,
Thanks for the reply.
Unfortunately, I've came across that article before and I wasn't successful in creating a DLL that I could load back into my VB6 Projects.
It does seem like it should work though...
Do you know if what is on that page can still be done? Or if they are any peculiarities I should be aware of?
Thanks much!
-
Feb 18th, 2013, 03:03 PM
#5
Re: ActiveX DLL- Include common Subs/Functions that should not need Object Instantiat
I haven't tried creating a DLL myself using the instructions there. But, based on the comments there, I suppose the author's method works. Did you follow the DLL example closely or did you deviate somehow?
On Local Error Resume Next: If Not Empty Is Nothing Then Do While Null: ReDim i(True To False) As Currency: Loop: Else Debug.Assert CCur(CLng(CInt(CBool(False Imp True Xor False Eqv True)))): Stop: On Local Error GoTo 0
Declare Sub CrashVB Lib "msvbvm60" (Optional DontPassMe As Any)
-
Feb 18th, 2013, 04:21 PM
#6
Thread Starter
Junior Member
Re: ActiveX DLL- Include common Subs/Functions that should not need Object Instantiat
Huzzah! Success!
I cannot believe it works! 
Only down side is that I neeed to remember use the proxy link.exe file in order to VB6 to have Windows DLL Compatibility.
Aside from that, the article does indeed work (although it sometimes is quite unclear).
Thanks much for the help Bonnie!
God Bless,
-Nick
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|