Results 1 to 3 of 3

Thread: VB6: Does anyone have experience with adding moudlarity to their apps?

  1. #1
    Variable Bitrate
    Join Date
    Oct 2004
    Location
    Bay Area, CA
    Posts
    374

    VB6: Does anyone have experience with adding moudlarity to their apps?

    I am been around VB6 for a while now an have built some pretty extensive applications with it. I have yet to be able to familiarize myself with adding modulatity though. What I'd like to be able to do it have a main application and allow users to download a file and place it in the app directory or run an installer. This will give them that functionality. This way I can upgrade a certain module of my application each time, and allow for many different options.

    I guess some sort of .dll or .ocx, but it needs to be able to be loaded and run after the application is built and out. I also want to be able to make new addons and have the VB detect their existance and load them too. Do you know of any tutorials or pages about this type of functionality?

    I have been looking around on Google, but what generally comes up is stuff about VB Modules, not what I need.

    Thanks!

  2. #2
    Variable Bitrate
    Join Date
    Apr 2006
    Location
    Dallas, Texas
    Posts
    264
    Well, I know that in VB.NET what you are looking for is a Interface. You would have an interface that a class from a DLL would implement. That way your original code can load the .DLL into memory and then create an instance of the class and call the implemented functions on the instanciated class.

  3. #3
    Newbie
    Join Date
    Sep 2006
    Posts
    15
    Under VB6 the trick is "Late Binding". It all gets a bit messy and is not particularly well documented but you use CreateObject("PackageName.ObjectName") to get an instance of some registered object, then from there you need to have some standard "plugin" interface that you require from third party developers so that you can call the functions etc. E.G. you may require that all valid plugins have a name property so it might go ...

    function loadplugin(byval pluginObjectName as string) as object
    dim result as object
    set result = nothing ' assume failure
    on error goto fail
    set result = createobject(pluginObjectName)
    if result.Name="" then set result = nothing ' We dont allow blank plugin names
    set loadplugin = result ' return object if ok.
    exit function

    fail:
    set result = nothing ' either object not registered or didnt implement name
    set loadplugin = result
    end function

    this function would return and instance of an object registered with the supplied classid as long as it implemented a member called name that returns a non-blank string. ActiveX controls are even messier; look into controlextender.

Similar Threads

  1. Embedding apps in vb6
    By Laidback in forum Software & Software Development
    Replies: 9
    Last Post: 05-09-2004, 08:44 PM
  2. Adding apps
    By craigyb in forum MediaCar
    Replies: 4
    Last Post: 12-01-2003, 07:52 AM

Bookmarks

Posting Permissions

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