DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   Visual Basic 4 / 5 / 6 (http://www.daniweb.com/forums/forum4.html)
-   -   ActiveX DLL reference (http://www.daniweb.com/forums/thread66646.html)

richburg Jan 7th, 2007 10:05 pm
ActiveX DLL reference
 
I have created activex dll using vb6. I have registered it using
regsvr32 on my clients pc. I call the dll functions from both VB exe file
and Excel VBA. All works fine so far. When I Remake my DLL file with
VB6 both the VB exe and the Excel VBA can no longer reference my DLL.
The version of my DLL is the same. For it to work I need to delete the
reference in Excell VBA and then Browse for the same DLL in the same
place and it works ok after that. For the VB exe file I need to do the same
and recompile the exe. How can I have the reference remain in place while
the dll file is the same? I want to be able to change my business logic in
the dll without having to reinstall all my software on my clients pc.

QVeen72 Jan 9th, 2007 5:30 am
Re: ActiveX DLL reference
 
Hi,

Use Late Binding of the .dll, like Create object.
Dont directly add the reference in VB6 (Calling project).

Dim MyObj As Object
Set MyObj = CreateObject("MyProj.MyDll")
This code creates an instance of the MyDll class that is defined by the DLL project named MyProj. After Creating the Class Object, U can use the Public properties and methods of the MyObj object just as if it had declared it using early binding. Now if you change the DLL's public methods, the compiled executable will still work (if you removed the methods the program uses). The problem with late binding is you don't get intellisense and calling the DLL's methods may take a bit longer time than it does with early binding.
And In Your Calling / Main Project, Just by Replacing the .dll, ur exe will work.


Regards
Veena

richburg Jan 9th, 2007 6:08 pm
Re: ActiveX DLL reference
 
That fixed it. Thanks very much


All times are GMT -4. The time now is 2:30 pm.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC