Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

help for DLL in VB

pixpix Member Posts: 1
[b][color=Red]
hey programmers!

I am learning VB 6 and wanted to know more about DLL files in vb . if possible please explain me how to code these file with sample example.
eagerly waiting for the replies from the keen programmers...





[color=Green][italic] -

-[/italic][/color]
[/color][/b]

Comments

  • BitByBit_ThorBitByBit_Thor Member Posts: 2,444
    A VB DLL file is a wrapper for COM classes.
    Note that this is not a property of DLL files, but just of VB DLL's!

    So what you do is, you program functions in a Class module. The access level of the class module (private, public, global) determines whether another app can access the class/functions.

    Private:
    For private use within the DLL file. Items of these types are not exposed.

    Public not creatable:
    A publicly visible class, but can not be created explicitly (New keyword can not be used). Classes of these types are usually created by the DLL (the DLL uses New and then gives a reference to the created instance to the calling App).

    Public Creatable:
    These are the 'normal classes' as you know them. There are exported (visible) and can be created using the New keyword.

    Global Multi Use:
    These classes are not really classes, but 'containers' for public functions. More of a namespace, to group functions. An instance of this class is automatically created when the DLL is loaded and all calls to functions that are a member of this class are directed to this one instance. I don't know what'll happen if you use the New keyword - I guess it would either throw an error, or it has no effect (eg, does not create a new instance and just referes to the original).

    Then, you need to add the DLL file as a Reference in the project where you want to use it. Create instances of public classes, or use it's global functions to access it's functionality.

    I already said this, but I'll say it again: VB classes only work through COM (ActiveX object). They can not be used like the Windows API's DLL's (like shell32.dll, advapi32.dll, which are of a different sort).

    Best Regards,
    Richard

    The way I see it... Well, it's all pretty blurry
Sign In or Register to comment.