Results 1 to 5 of 5

Thread: Creating DLLs

  1. #1

    Thread Starter
    Member
    Join Date
    Nov 1999
    Location
    Manila, Philippines
    Posts
    59

    I have several resuable functions and subroutines that i want to encapsulate into a dll. The problem is, I don't know how. What i'm doing today is that I put them in several standard modules and add that modules to my project.

    I know that this is a very simple question but believe me, I really don't know how to do it.
    I tried to put all of them into a ActiveX dll project but I don't have a class in it and so VB did not allow me to create the project.
    Mikey
    A/P
    Using VB6 SP4 Enterprise Ed.

  2. #2
    Addicted Member S@NSIS's Avatar
    Join Date
    Aug 2000
    Location
    Stoke-On-Trent, England
    Posts
    243
    Hi,
    Start up VB and select ActiveX DLL as your project. Then copy your code from your modules(.bas) and paste it into a class module in your new project. (You can add more class modules to the project by right-clicking in the project explorer and going Add>Class Module).
    You can then compile this into a DLL and reference it in the normal way to use it's methods,propereties and events.

    Hope this helps

    Shaun
    Web/Application Developer
    VB6 Ent (SP5), Win 2000,SQL Server 2000

  3. #3
    Addicted Member jeroenh's Avatar
    Join Date
    Aug 2000
    Location
    Rotterdam, Holland
    Posts
    201

    Thumbs up

    When you are realy smart you take a look at http://www.vbsquare.com and look for the articels named "Beginning object in VB". I used them and I have now created my first DLL used for multiple functions my collegue wanted to use. It had to be a DLL becouse he only wants to program in VBA and VB.

    I wish you good luck. I know you can do it. After all I could.
    Catch you later,

    Jeroen Hoekemeijer
    Code:
    If 1 = 2 Then MajorError

  4. #4

    Thread Starter
    Member
    Join Date
    Nov 1999
    Location
    Manila, Philippines
    Posts
    59
    Thanks! I started doing the advice of S@NSIS. It works but since its a class, i have to create an instance of the class and then expose the objects methods, properties, etc.. Now, I want to use the methods in my library as if i'm calling a VB function. Just like this:

    msgbox "Hello" 'vb function
    messagebox "Hello" ' a function called from my library

    I'm now checking out vbsquare's beginning objects series. Thanks guys!


    Mikey
    A/P
    Using VB6 SP4 Enterprise Ed.

  5. #5
    Frenzied Member mlewis's Avatar
    Join Date
    Sep 2000
    Posts
    1,226
    Try this:

    create a DLL project with a class in it

    set the class Instancing property to GlobalMultiUse or GlobalSingleUse (if you do a Help on the Instancing property you'll find which one is better, I can't remember off the top of my head and I'm too lazy to open VB)

    make all your functions, variables, Types, etc members of the class
    M. Lewis
    Pi-Q Software
    How many mouse clicks does it take to cook breakfast?

    Blargh! I am dead!

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