|
-
Jun 20th, 2009, 04:07 PM
#1
Thread Starter
Hyperactive Member
[RESOLVED] Store functions into DLL and call at Run Time ???
This may seem a little odd and I have never done anything like this so I hope someone could help me here.
I have an app that has some subs stored in a module. The problem is that I have to adjust these subs from time to time but I don't want to prompt the user to install a whole upgrade every time I make changes to a few lines of code in the sub.
What I would like to do is simply take these subs and compile them into a dll or anything else that works and have them loaded when the app runs. I have at least 13 reasons to need this,,, 
Is anything like this possible without creating a ton of complicated code? If yes, HOW? could I do this or something similar?
-
Jun 20th, 2009, 04:09 PM
#2
Thread Starter
Hyperactive Member
Re: Store functions into DLL and call at Run Time ???
Oh, I have no problem supplying the user with an upgrade of that potential external "sub holder"
-
Jun 20th, 2009, 04:22 PM
#3
Fanatic Member
Re: Store functions into DLL and call at Run Time ???
using a an ActiveX dll is your perfect solution.
to do that, you need to start a new activeX dll project. vb automatically adds a class.
store all your fucntions in this class.
if you want separate class for each group of functions (say Cfile.cls for file fucntions), then do so.
change the property of the class to multiuse
compile the project and reference the dll in your app.
you can as well add the whole dll project to your app project so that you can step through code when debugging.
to use any of the functions in the dll project class say (Cflie.cls) do this
at module level
dim oFileFunctions as CFile
'in the sub or function you need the functions, do this
set oFileFunctions = new CFile
strFileContents=oFileFunctions.ReadFile(args)
try it out!
i hope it helps
Last edited by coolcurrent4u; Jun 20th, 2009 at 04:29 PM.
Reason: typo
-
Jun 20th, 2009, 04:39 PM
#4
Thread Starter
Hyperactive Member
Re: Store functions into DLL and call at Run Time ???
And I can initialize it when I need it right? Just like any other ActiveX?
I am looking for a minimalistic example somewhere to get me to understand the concept, all I am finding is just toooo much code. I like to start SMALL ... but I see where you are going with this,, I was just poking around and was led in the same direction as you are suggesting.
Do you happen to know if there is an idiot proof example of this somewhere,,, like Form1.exe and cls1.dll and A+B=C in it?
Thanks for the help
-
Jun 20th, 2009, 04:57 PM
#5
Thread Starter
Hyperactive Member
Re: Store functions into DLL and call at Run Time ???
Awesome,,,, I think I found something that helps me get it. It is here:
http://www.xtremevbtalk.com/archive/...hp/t-7290.html
One question,,,,
If I need to reference another active x components for the dll code to work, do I reference it in the active x project as I would in a normal project?
-
Jun 20th, 2009, 04:57 PM
#6
Re: Store functions into DLL and call at Run Time ???
You can read over this short tutorial. Suggest googling for other "ActiveX DLL tutorial" links.
If you choose to use a DLL, the DLL will have to be distributed along with your exe.
We posted at the same time. Your DLL project is its own project. Reference whatever is required in that project.
-
Jun 20th, 2009, 05:16 PM
#7
Thread Starter
Hyperactive Member
Re: Store functions into DLL and call at Run Time ???
Thanks LaVolpe I am wrapping my head around it,, it is not as bad as I thought it might be,, in fact this is incredibly useful,, !!where have I been so far!!!! lol,,,
I am getting it and it is working out fine for what I need
-
Jun 20th, 2009, 06:54 PM
#8
Thread Starter
Hyperactive Member
Re: Store functions into DLL and call at Run Time ???
Ok,, one last question and I think I have it down,,,
When a dll is upgraded and it gets replaced on user's machine does it have to be re-registered? (Would make sense to me,,, but I have to make sure)
-
Jun 20th, 2009, 07:07 PM
#9
Re: Store functions into DLL and call at Run Time ???
Depends on what is upgraded. If you are simply modifying the interior code of an existing function, then no, not as long as the Binary Compatibility option is checked in the project properties window. However, if you add new functions, remove functions, or modify the return value/parameter information of a function, then yes. And if the Binary Compatibility option is checked, you should get a warning that it can't be compiled using the same compatibility (indication new DLL will need to be re-registered). If the binary compatibility option is not selected, then the answer is always yes.
You can read a bit on this from a great VB5-related book (applies to VB6 also). Don't expect to understand it all, it may seem a bit heavy.
I am not an expert on "DLL hell" but others are in the forum. They may opt to pipe in. Google "DLL Hell", it is a real programming term.
-
Jun 20th, 2009, 07:09 PM
#10
Thread Starter
Hyperactive Member
Re: Store functions into DLL and call at Run Time ???
alright, I get it... thank you
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
|