Rather than consolodating our current DLL's I would like to be able to execute other dll's from a "master" dll if you will. Is this possible if so could someone post the snippet?
Thanks!!
Printable View
Rather than consolodating our current DLL's I would like to be able to execute other dll's from a "master" dll if you will. Is this possible if so could someone post the snippet?
Thanks!!
Hm...
If they'are ActiveX DLLs (created in VB) and they have been registered then you could probably use late-binding (CreateObject()) and then call a function.
Here's an example...
Create a new VB project for an ActiveX DLL. Name the project `TestDLL`, and name the class module `VBDLL`.
Put this code in there:
vb Code:
Option Explicit Public Sub Test() MsgBox "Hello, world!", vbInformation End Sub
Then, compile and close.
Then, start a new VB project (standard EXE), and put this code in it:
vb Code:
Option Explicit Private Sub Form_Load() Dim objMyDLL As Object Set objMyDLL = CreateObject("TestDLL.VBDLL") objMyDLL.test Set objMyDLL = Nothing End Sub
It should show the message box.
If using late binding, I am not sure how your apps can instantiate a class belonging to the other DLLs, from your new main dll, especially if Intellisense is desired.
If however you add your other DLLs as references to your new main DLL, then you can expose those other dll's classes via a new public property in your new main dll.
Example. Let's say you had a DLL named Drawing.DLL with a class called Surface and another DLL named Subclasser.DLL with a class called Client.
Assuming your Drawing & Subclasser DLLs are referenced in the main DLL:
Just thinking off top of my headCode:' main DLL, let's say the public class is called Core
Dim mySurface As Drawing.Surface
Dim myClient As Subclasser.Client
Public Property Get DrawingSurface() As Drawing.Surface
If mySurface Is Nothing Then Set mySurface = New Drawing.Surface
Set DrawingSurface = mySurface
End Property
Public Property Get SubclasserClient() As Subclasser.Client
If myClient Is Nothing Then Set myClient = New Subclasser.Client
Set SubclasserClient = myClient
End Property
' in your app, you will have the Main dll referenced and Core class is public, then...
Dim theCore As New MainDLL.Core
Call theCore.DrawingSurface.SomeSub()
Call theCore.SubclasserClient.SomeSub()
....
Edited. The downside you will have trying to wrap all your other DLLs with a new DLL is that all the other DLLs will become dependencies of the new DLL. So you'd still have all your other DLLs plus the new main DLL. If you actually combined all your DLLs into a new DLL, then you'd just have one large DLL vs the many smaller ones. "Six of one, half-dozen of the other."
It says "Active X object can't create object" - do I need to add references besides active x data objects 2.8?
*will check the way you suggest LaVolpe!
thanks guys!