Click to See Complete Forum and Search --> : Making Own .dlls
sql_lall
Aug 8th, 2002, 06:09 AM
Currently, i have a module containing many subs i use in a large number of programs. what i want to know is:
1) How can you convert subs into functions
2) How can i make my own .dll containing all of these functions (similar to an #include .h file for c++
peet
Aug 8th, 2002, 06:20 AM
1. converting subs into functions does not make much sense... ??
Private Sub DoStuff()
End Sub
Private Function DoStuff()
End Function
2.
Start a new project, select ActiveX dll
Name the class as you want
Set the class 's instancing to 6-GlobalMultiuse
Add the subs/functions needed
compile
:)
peet
Aug 8th, 2002, 06:23 AM
some more input reg. the instancing prop. :)
MSDN
Instancing Property
Sets a value that specifies whether you can create instances of a public class outside a project, and if so, how it will behave. Not available at run time.
Settings
The Instancing property has these settings:
Setting Description
1 (Default) Private. Other applications aren’t allowed access to type library information about the class, and cannot create instances of it. Private objects are only for use within your component.
The Instancing property default varies depending on the project type. Private is the default only for class modules in Standard Exe projects.
When you insert a new class module into an ActiveX Exe project or an ActiveX DLL project, the default value of the Instancing property is MultiUse. When you insert a new class module into an ActiveX Control project, the default value of the Instancing property is PublicNotCreatable.
2 PublicNotCreatable. Other applications can use objects of this class only if your component creates the objects first. Other applications cannot use the CreateObject function or the New operator to create objects from the class.
3 SingleUse. Allows other applications to create objects from the class, but every object of this class that a client creates starts a new instance of your component. Not allowed in ActiveX DLL projects.
4 GlobalSingleUse. Similar to SingleUse, except that properties and methods of the class can be invoked as if they were simply global functions. Not allowed in ActiveX DLL projects.
5 MultiUse. Allows other applications to create objects from the class. One instance of your component can provide any number of objects created in this fashion.
6 GlobalMultiUse. Similar to MultiUse, with one addition: properties and methods of the class can be invoked as if they were simply global functions. It’s not necessary to explicitly create an instance of the class first, because one will automatically be created.
jim mcnamara
Aug 8th, 2002, 09:47 AM
What may you want is a .CLS module, probably, rather than an external dll -- based on what you asked.
The external dll is a COM object, which means that you can run afoul of problems with COM interface versions unless you are REALLY careful about binary compatiblity.
With an internal class module, the interface version problem goes away. But, you lose something. Everytime you change the .CLS modules (your 'run-time') you have to recompile all of the separate pieces of code that use it. Of course, if your module is completely static, there is no problem.
Your call.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.