Solved

Sub-Sectioning a DLL file

Posted on 2004-04-17
8
153 Views
Last Modified: 2010-05-02
Hi experts!

I'm writing an ActiveX dll from VB which has got a LOAD of different functions.  What i'd ideally like to do, for the sake of easy scripting is to subdivide to dll.

EG  rather that going:

MyDll.GetRecordset

MyDLL.RandomNumber

to have

MyDLL.DatabaseFunctions.GetRecordset

MyDLL.NumericFunctions.RandomNumber

If not i'll just have to write 2 DLL files or tolerate it as it is.

Thanks for you help and time.

Bobeo
0
Comment
Question by:Bobeo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
8 Comments
 
LVL 44

Expert Comment

by:Arthur_Wood
ID: 10849087
A single DLL can hold MULTIPLE classes, and each class can provide its own set of methods and properties.

So your DLL would have the classes

Public Class DatabaseFunctions
   Public Function GetTRecordSet() as Recordset
     ' add you code here
   End Function

End Class

Public Class NumericFunctions
   Public Function RandomNumber() as Single
     'add your code here
   End Function
   
   Public Function RandomNumber(Seed as Integer) as Integer
     ' add your code for this version of the function
   End Function

   Public Function RandomNumber(LowValue as Integer, HighValue as Integer) as Integer  
     'add code for the function to return a value between LowValue and HighValue  
   End Function
End Class


then you access these functions, in their separate classes within your DLL, exactly as you have described in your question.

AW
0
 
LVL 44

Expert Comment

by:Arthur_Wood
ID: 10849092
the above was in .NET, in VB 6, you cannot have two functions with the same name, so your code would look like this:


Public Class DatabaseFunctions
   Public Function GetTRecordSet() as Recordset
     ' add you code here
   End Function

End Class

Public Class NumericFunctions
   Public Function RandomNumber() as Single
     'add your code here
   End Function
   
End Class
0
 
LVL 3

Author Comment

by:Bobeo
ID: 10849104
Hi Arthur_Wood!  And thanks for your reply!

but when i put

Public Class DatabaseFunctions

into my Class module it give me the error

Compile Error
Expected: End of statement

Am I doing something wrong?!
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 3

Author Comment

by:Bobeo
ID: 10849117
It's picking up the word 'Class' as a variable, not a function.

As in

Public Class as Integer

Etc!
0
 
LVL 3

Author Comment

by:Bobeo
ID: 10849261
Upping the points to 500
0
 
LVL 3

Author Comment

by:Bobeo
ID: 10849622
OK, problem solved.

I used the VB Class Builder Add-In to drag all of my classes into one class, the compiled the DLL from that.

Will get Community Support to close the question
0
 
LVL 1

Accepted Solution

by:
GhostMod earned 0 total points
ID: 10881776
PAQd, 500 points refunded.

GhostMod
Community Support Moderator
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

728 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