Click to See Complete Forum and Search --> : Excuse my ignorance...
HarryW
Jan 18th, 2000, 10:59 PM
Err, I know this is a really simple question, and you'll all laugh and point at me, but what's a DLL and what use is it? I know you need certain DLLs to run certain apps, and that DLL stands for 'dynamic link library' or something, and I've inferred from what people have said that you can make them using VB/C++ but I really don't know what one is.
Same goes for ActiveX controls actually.
I've used VB now and then for about 2 years, but I was at college (that's A-Levels to all you Americans out there) so I was too busy wasting my time to be concentrating on programming :)
Can anybody help me out?
MicahCarrick
Jan 19th, 2000, 12:21 AM
If you'll notice when you declare API's that there's often a dll reference (or just "kernal32" and "user32" which are DLL's in your system folder). Same thing. You can reference individual functions from VB in the same manor. You can compile ActiveX DLLs in VB, but most often, DLL's are written in Visual C++ from what I've been able to learn.
HarryW
Jan 19th, 2000, 06:07 AM
I've never used APIs, so I haven't noticed, but I'll be sure and notice it when I do :)
Thanks a lot for the explanations Micah.
badgers
Jan 19th, 2000, 06:31 AM
here is another question about this topic.
I customize autocad with VB instead of VBA.
most people recommend that I make DLL files instead of EXE files because my program will "interact" with autocad faster as a DLL
I don't understand why a DLL will interact with autocad faster. Can someone explain this?
Also, I thought that a DLL could have a form
------------------
I am so skeptacle, I can hardly believe it!
MicahCarrick
Jan 19th, 2000, 07:18 AM
Yes a DLL can have a form ... or message boxes or whatever. I'm no expert keep in mind. I'm assuming the a dll would be faster because it's reading the functions as it needs it where as an exe probably hass to execute tons of it's own functions before even interacting ... that is the program has to load and create all it's classes and objects.
But I'm just guessing here :)
MicahCarrick
Jan 19th, 2000, 11:12 AM
Not an ignorant question at all. I'm no expert or anything but can tell you this. DLL's contain functions that can be called from your, or any other program so that certain functions that are commonly used don't have to programmed in ever program but each program can call to that one instance of it. Also, if a more efficient function is written, simply replacing the dll with a new one can be done, providing it's not changed to the extent that names and return values are changed.
ActiveX (OCX) controls are the same idea, only they include a graphical interface. They can be created in VB using normal VB code. This way if you have a bunch of controls that behaive in a particular manner together that you use often, creating an OCX for them could be one solution. Say for example you make your own progress bars by putting a label in a picture box and making it "Grow". You could create your own activeX control by placing those same controls and code in the OCX and the compiling and registering it with windows. Then when you open the components dialog, your control would be there.
If perhaps you're interested in creating your own controls, there's a brief intoduction tutorial on this site in the "Active X" section under "Topic Areas"
------------------
Micah Carrick
http://micah.carrick.com
micah@carrick.com
ICQ: 53480225
HarryW
Jan 19th, 2000, 11:21 AM
DLLs sound a bit like modules. Is that right? Are they similar?
So ActiveX controls are like mini-projects then? You can make a set of controls (the picture box and label in your example) and add code to them to make them behave in a certain way, andthen compile them into an ActiveX control. Then, later on, when you want to use that same mini-project in a normal project, you can just sort of import it by using it as a control. Just like you might place a text box on a form. Am I close?
MicahCarrick
Jan 19th, 2000, 11:35 AM
Yes, that's just about it. DLL's are what make visual basic possible. That's why your EXE is so small, because all the functions and routines for common tasks are stored in DLL's that many many programs share, Runtimes etc.
A mini project is a perfect way to think of an activeX control. A little mini project that is customizable in some ways and can be used over and over by you and anyone else who wants to use it, provided you give it to them.
Clunietp
Jan 19th, 2000, 11:47 AM
DLL's should NEVER (well, almost never) have a user interface. DLL's are libraries of methods and sometimes resources, but the user interface/interaction should be left up to the UI developer. DLLs perform the logic and return a value to the calling app, and the calling app decides what to do with the return value.
DLLs are a way to reuse code, partition an application into separate logical layers, and provide incremental improvements to the dependant applications without having to recompile your client EXEs. They also allow for higher level development (VB!) because we can call a function in a library and have the library perform the task for us (example: API's) so we don't have to try to reinvent the wheel every time we write a new app.
HarryW
Jan 19th, 2000, 11:55 AM
Thanks, that's cleared it up a lot.
How would you go about making a DLL then? I've called functions that I've made from modules before, is a DLL just the same kind of thing as a module? Do you need APIs and things like that? (APIs are another thing I'm not sure about - I'll be reading up on them some time soon.)
Phil.Hebert
Jan 19th, 2000, 02:00 PM
DLL Stands for Dynamic Link Library
I think!
ivyl
Jan 19th, 2000, 03:36 PM
This text was taken from Programming MS Visual C++, 5th edition:
"Basically, a DLL is a file on disk (usually with a DLL extension) consisting of global data, compiled functions, and resources, that becomes part of your process. It is compiled to load at a preferred base address, and if there's no conflict with other DLLs, the file gets mapped to the same virtual address in your process. The DLL has various exported functions, and the client program (the program that loaded the DLL in the first place) imports those functions. Windows matches up the imports and exports when it loads the DLL."
HarryW
Jan 19th, 2000, 03:39 PM
That's what I thought. *Points to Phil's message* Why dynamic? I get the idea that they're libraries of functions. Not sure what makes them dynamic though.
[This message has been edited by HarryW (edited 01-20-2000).]
Clunietp
Jan 20th, 2000, 11:48 AM
Dynamic means that they are loaded at runtime when a function within the library is needed, and unloaded when not needed.
If it were not dynamically loading/unloading, your app would load every DLL into memory at startup that it may have only needed once, wasting memory resources, and would not unload them until the app is terminated.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.