Solved

DLL Declaration

Posted on 2000-04-12
7
317 Views
Last Modified: 2010-05-02
This guy made his own dll AceVB.dll he declared it in this project:

Declare Function AceTimer Lib "AceVB.dll" () As Integer

He didn't declare the full path to the dll, so I was wondering how you can get away with this. Does registering the dll allow you to access it this way (by just using it's name and not it's path).

Also, this seems stupid to me becsuase if the answer is yes, then why not get a reference on it in the project and use it like an object in your project.
0
Comment
Question by:tyy8
  • 3
  • 3
7 Comments
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 2708674
You can't register that kind of DLL.

To access it, the DLL must be place in a folder of your path (type Path a the command prompt).
0
 
LVL 3

Accepted Solution

by:
peteyhiggins earned 50 total points
ID: 2708855
For certain directories on your computer, the operating system automatically looks in those to see if a dll or exe is present in them.

C:/winnt/system32 is an example of this on Windows NT.

That's why when you want to unregister a DLL, you can type regsvr32 name.dll.  This calls the regsvr32 application that's located in the sytem32 directory, even though you don't have to specify which directory regsvr32 is in, your computer automatically looks for it there.

To see this, on a Windows NT computer, right-click My Computer, go to properties and click the environment tab.  There are listings for both System Variables and User Variables.  Both of these have a path listing that will show you all of the folders that the computer looks in to find dlls and exes.

Peter

0
 

Author Comment

by:tyy8
ID: 2709164
Okay, but is it possible to declare your dll that way (like something from the WinAPI) and access that function directly.

To emoreau: Th setup program did register it on my system, so I don't understand what you mean when you say you can't register that kind of dll
0
Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

 
LVL 70

Expert Comment

by:Éric Moreau
ID: 2709203
DLL that are registred are used by automation. To use them, you set a reference to it (Menu Project->References) and instantiate it (dim x as AceVB).

This DLL, can be distributed but is not necessarely registered. Can you register it manually (with regsvr32.exe)?
0
 

Author Comment

by:tyy8
ID: 2717388
I tried and it said it had no entry point, whatever that means.
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 2717405
So this means that this DLL isn't refered (found) via the registry. So it it found via the path.

There are 2 kind of DLL.
-Automation
-Function library.

Automation DLL are referenced and use as an object and then access properties and methods.

Function DLL are librairies that you declare like you did to use.

«then why not get a reference on it»
Because you can't reference a function library DLL that isn't registered.
0
 

Author Comment

by:tyy8
ID: 2899502
Answer accepted
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Saving history changes to sub form 4 48
How to debug this code 7 64
vb6 connector to SQL Server 2 37
pop out of webbrowser1 control vba6 5 26
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

827 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question