Results 1 to 4 of 4

Thread: VB6 A simple approach to Lighweight-Classes

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Jun 2013
    Posts
    6,122

    VB6 A simple approach to Lighweight-Classes

    As the title says already - another approach to LW-COM -
    hopefully simple(r) to understand, because:
    - it doesn't require to implement "all the Methods in the *.bas-Module"
    - instead, method-implementation remains in the Class-CodeFile
    - only the 3 Members of the IUnknown-interface will be swapped

    On 32Bit, the minimal Class-Instance-size is only 8Bytes (half the size of a Variant).

    Userdefined Private-Variables (when added to the two default-instance-members),
    will increase the mem-usage from these 8Bytes obviously...
    Performance (especially on instance-teardown) is as nice as one would expect from an lw-approach...

    I've commented quite a bit, so there's more explanations in the code-modules.

    Here's the Zip: SimpleLightWeightObjects.zip

    Have fun,

    Olaf

  2. #2
    Hyperactive Member
    Join Date
    Mar 2019
    Posts
    290

    Re: VB6 A simple approach to Lighweight-Classes

    This looks interesting. Excuse my ignorance but does this buy speed, save memory or both?

    cheers

  3. #3
    Fanatic Member
    Join Date
    Aug 2020
    Posts
    845

    Re: VB6 A simple approach to Lighweight-Classes

    Quote Originally Posted by vbwins View Post
    This looks interesting. Excuse my ignorance but does this buy speed, save memory or both?

    cheers
    Yes, Light-COM can not only drastically increase speed, but also save memory. It's just that you need more code, and it takes a lot of practice to master the skills of Light-COM.

  4. #4
    Fanatic Member
    Join Date
    Aug 2020
    Posts
    845

    Re: VB6 A simple approach to Lighweight-Classes

    I did a quick tes and the new solution does make Lightweight-COM a lot easier. But I haven't tested slightly more complicated cases, such as my SimpleList's lightweighting.
    Last edited by SearchingDataOnly; Jun 15th, 2022 at 07:21 AM.

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