DLL, OCX and others

Access2007User

Registered User.
Local time
Today, 14:56
Joined
Aug 20, 2009
Messages
48
What is the purpose of DLL, OCX and other file type which are accompanied to the EXE file?

How to use them?
 
They're all basically library files. They contain a group of re-usable code performing certain functions or providing certain objects for any applications to use.

If you're familiar with Access, you can think of a VBA module as a potential library file that's statically linked. .DLL = Dynamically Linked library so you don't have to know the path of the dll file; just the name of the file (ProgID is the technical term, if my memory serves) so you can just use registry to retrieve the desired file.

In VBA editor if you go to Tools -> References, and add say, Microsoft Excel Object Library, you're adding a .DLL file. DAO is also a .DLL of its own.

OCX usually means ActiveX controls, but there are several other library files with different extensions as well.

HTH.
 
Ow I see. So in making my vb6 exe project, I have the option to make the modules saved internally or save the modules saved externally as DLL or OCX.

So if I am going to save the modules externally as DLL or OCX, aside from using Tools -> References, and add reference, is there also a way to add reference using VBA?
 
Well, I don't know about VB6 but I imagine you have to use appropriate project template or at least pass the directives to the compiler to treat it as a library file. It's not enough just to have the module/code, it has to be prepared in a certain manner so it can be exported as a .dll instead of a .exe. I'm sure you'll find more info if you google on this.
 
when vb6 starts, it let you choose whether you are going to make exe, ocx, or dll. So if I am going to save my code as dll file, do you know I will I call that library inside my exe file using vba aside from using the Tools->Preference and add the library?
 
If it's COM-visible, yes.

EDIT: Wait, what is the .exe file's role in this? If you mean you want your VBA code to call your .exe file, no that's not correct way to do it. You should want your code that you need to be available from anywhere, whether by your .exe file or by VBA to be stored in a separate library file.
 
what do you mean about COM-visible?

No, the .exe file's role is just like the frontend application and the vba code should call the dll file to be used by the exe file as its library (module).

How can I call that library inside my exe file using vba aside from using the Tools->Preference and add the library?
 
COM is Microsoft's specifications for making code available and understood by various application, defining what interfaces we need to have, and how it should be called, how to deal with conflicts, and all that. Access can handle COM objects with relative ease.

I'm sure if you google for developing COM-visible library in VB6 (using a bunch of different keywords as well), you'll find several hits to informative articles & resources.
 
I have been googling but what I have found is this only that I should include in the code as have been stated there:

[assembly: COMvisible(true)]


others are not for vb6 but for C# and C++
 
As you are new to VB6

When you first start to build an application in VB as you would in Access you need to create the application that is going to contain the different elements of the program. In Access this is the Mdb therefore in VB you create a standard exe project. Until it is compiled is bears the extension vbp (visual basic project). You then add you forms reports modules etc to build the application. on completion you make a exe out of the project ready for distribution. I suggest you get a book on VB with tutorials.

David
 
yes, I have reference material to read DCrake but what it doesnt say there that I want to know is how to use the DLL or OCX file in my exe file without going Tool->Reference and add the reference there. Simply saying, can it be done in vba code to call that dll or ocx in my exe file.

I just want to grasp that idea in my mind so as to have a general overview how those files work together.
 
Ok I bought a third party set of studio controls a few years ago that were specifically for vb6. After I installed and registered them on my machine so that I could use them in my project I need to tell the project which ones I wanted. For example a special combo box called ctCombo5.OCX I then click on the toolbox and select components, this open up a browser for me to locate the specific ocx file which I then apply. this then appears in my toolbox ready for selection.

When you make an exe from your project it recognises these addtional components and addss them to the package so that when installed on a new pc it installs and registers the said ocx's onto the target machine.

David
 
ok. so you mean it ("When you make an exe from your project it recognises these addtional components and addss them to the package so that when installed on a new pc it installs and registers the said ocx's onto the target machine.") automatically installs the said ocx's onto the target machine?

May I ask what was that third party set of studio controls. may be I can purchase them someday. Or maybe you know of other third party tools for VB6 Dcrake.

By the way, may I know also your time right now there in your country. My time now is 4:22 in the afternoon.
 
I am 6 hrs behind you

Here is the link to the website where I got the controls from
http://www.dbi-tech.com/productpage_StudioControlsCOM.aspx

Ok they are a bit expensive but I'll tell you what they have repaid themselves several times over in the way they enhance the projects and make programming easier. I am not endorsing their product in any way and do not receive any commission from them, I am simply pointing you in the same direction I was once pointed.

David
 

Users who are viewing this thread

Back
Top Bottom