Results 1 to 9 of 9

Thread: DLL how to make and use?

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jul 1999
    Posts
    1,800
    How will dll files help my program? How do I make them? Any information will help a lot.


  2. #2
    Addicted Member
    Join Date
    Jan 2000
    Location
    Sydney, Australia
    Posts
    196
    Firstly:

    How will a dll help your program: not sure really but i know it will add one more file that will need to be shipped with your application.

    You make them by opening up VB, and when you get the "New Project" dialog box, choose "ActiveX DLL"

    I made a DLL once - here is my the contents of my brain:

    By default you get a class module in your ActiveX DLL project.

    The initialiser (
    Code:
    Private Sub Class_Initialize()
    ) gets kicked off when you declare a new instance of your dll in the source code that uses your dll. But before you use your DLL in the project you have to add it as a reference (Project|References...)

    I mean, the DLL itself can do anything you want it to do, its just a class that gets brought in dynamically at runtime. For example, i made a DLL that presented the user with a MsgBox that asked whether they wanted to overwrite the current file and gave the typical "Yes", "No", "Yes To All", "Cancel" options.

    The methods that you declare as public can be called from the project that uses your dll.

    Just say you created a DLL called "myDLL" with a public sub called myPublicSub

    in the project that uses your dll you go (from memory):
    Code:
    Dim theDll as new myDLL
    Then you can go:
    Code:
    theDll.myPublicSub
    As you can see it really just behaves as a class. In my DLL i had a public method that set the message to be displayed on the MsgBox, and one that displayed it vbmodally.

    I hope this helps, its not a wealth of knowledge but it might get you started. I used the MSDN library for information on how to create DLLs.

    Mark...


  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Jul 1999
    Posts
    1,800
    Wow thanks a lot, now i just have to fiddle around with these things!

  4. #4

    Thread Starter
    Frenzied Member
    Join Date
    Jul 1999
    Posts
    1,800
    Wait...why not just use a global variable. DLL files just add more files to send, what extra feature do they have that i am missing?

  5. #5
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Don't make any Dll's by your own, cuz you don't need to. The extra feature is that, there will be one more file in your app. Dll's are used to share code between different apps, in compiled versions, and that's what I think, is unneccesary unless you have a bunch of apps that uses the same code. I do still not recommend you to make these, mainly because they're additional files but also, (I don't know if) others can use your code.

  6. #6
    New Member
    Join Date
    Jan 2000
    Location
    mount clemens, mi, us
    Posts
    12
    the main feature of dlls, as far as i can tell, is firstly it's how api calls are all done.
    and it allows you to make a program that is just a list of functions and procedures to do a bunch of quick little calculations/graphics/whatever in c (or any language capable), and call these from visual basic. essentially you can make some pretty slick programs by "mixing" c and vb.

  7. #7
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744
    This is wrong saying:


    Don't make any Dll's by your own, cuz you don't need to. The extra feature is that, there will be one more file in your application.


    I would have to totally dissagree. When I write my projects, I make all my forms as COM objects, that is I have those forms in ActiveX DLLs rather then in EXE. The reason for that is because when you have a multi-user environment, you would have to kick everyone out of the program in order for you to upgrade the program if you made any changes to it. Where COM objects are stored on the server, so the next time the user logs into the program they will get new (or updated form).

    Also, if you have your DLL written for some calculations or database operations, it leaves your EXE smaller in size, in oppose to compiling it into your EXE (using Class modules) it expands the size of your EXE even if you don't use these functionalities all the time.

    Just my $0.02

  8. #8

    Thread Starter
    Frenzied Member
    Join Date
    Jul 1999
    Posts
    1,800
    What is a COM project, does this mean i can make programs so that the user has to log in everytime, they have to be online? I think i'll look into this more also.

  9. #9
    Member
    Join Date
    Jan 1999
    Location
    Vancouver, BC, Canada
    Posts
    32
    With the exception of what Serge said, this thread has contained a lot of misinformation.

    ActiveX DLL's (and ActiveX EXE's and OCX's for that matter) are the foundation of COM, and COM is CRITICAL to any serious application today

    Using these ActiveX components (COM components) you can create REUSABLE, more SCALABLE and more MAINTANABLE code. You can also separate the logic of your application into multiple 'tiers'. This is known as N-tier development, where you have a presentation layer (forms or a web page, for example), a business layer (your custom business rules), and a data layer (data sources - SQL server, Access, etc). COM components factor heavily into the business layer, where you can create 'pieces' that are independent of the other 2 layers. As Serge mentioned, the idea is that, if your business rules change, you only have to change code in the relevant business component (object) instead of re-coding, testing, and re-deploying the ***entire*** application.

    There are dozens of reasons to 'componentize' your development, too many to list here. So here are a few links to **GREAT** articles that I guarantee will help you understand the concepts:

    http://www.comdeveloper.com/articles/vbintro.asp
    http://msdn.microsoft.com/library/te...ifacebased.htm
    http://msdn.microsoft.com/library/pa...ctsclasses.htm
    http://visualbasic.about.com/compute...mpchap/231.htm

    Also go to MSDN and search on the words COM, DNA and N-TIER or 3-TIER, you'll get a wealth of info back.

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