Results 1 to 4 of 4

Thread: Making Own .dlls

  1. #1

    Thread Starter
    Fanatic Member sql_lall's Avatar
    Join Date
    Jul 2002
    Location
    Up Above (i.e. AUS)
    Posts
    571

    Talking Making Own .dlls

    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++
    sql_lall

  2. #2
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    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

    -= a peet post =-

  3. #3
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    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.
    -= a peet post =-

  4. #4
    Frenzied Member
    Join Date
    Jul 2002
    Posts
    1,370
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width