Page 1 of 3 123 LastLast
Results 1 to 40 of 119

Thread: VB6 Built-in types extension library (FTypes)

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jul 2015
    Location
    Poland (moved away from Belarus)
    Posts
    110

    VB6 Built-in types extension library (VBTypes)

    Project sources are now located at BitBucket (https://bitbucket.org/hwoarang84/vbtypes/src/main/). See all related links at the bottom of the thread.

    This project extends Visual Basic 6.0 built-in data types by wrapping basic types into appropriate classes with lots of powerful functionality. You can work with types in much more convinient way (inline if needed), perform effective conversions, checks, transformations and take advantage from using other built-in features.

    CLASSES:

    - ArrayEx
    - BooleanEx
    - ByteEx
    - CurrencyEx
    - DateTimeEx
    - DecimalEx
    - IntegerEx
    - ListEx
    - LongEx
    - DoubleEx
    - SingleEx
    - StringEx

    DOCUMENTATION:

    VBTypes Manual (PDF format)

    WIKI | HISTORY

    SUBMODULES:

    - git submodule update --progress --init --force --remote -- "Ext/vbCore"

    TESTING:

    https://bitbucket.org/hwoarang84/vbt...i/Installation

    LATEST VERSION:

    https://bitbucket.org/hwoarang84/vbtypes/get/main.zip

    LICENSE AGREEMENTS:

    This software is provided 'as-is', without any express or implied warranty. In no event will the author be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:

    1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
    2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
    3. This notice may not be removed or altered from any source distribution.
    Last edited by hwoarang; Aug 10th, 2021 at 10:46 AM.

  2. #2
    Lively Member
    Join Date
    Sep 2016
    Location
    Texas panhandle
    Posts
    64

    Re: VB6 Build-in types extension library (FTypes)

    Nothing in the zip except the Dll.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jul 2015
    Location
    Poland (moved away from Belarus)
    Posts
    110

    Re: VB6 Build-in types extension library (FTypes)

    Quote Originally Posted by VBClassic04 View Post
    Nothing in the zip except the Dll.
    My apologies. Corrected now.

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Jul 2015
    Location
    Poland (moved away from Belarus)
    Posts
    110

    Re: VB6 Build-in types extension library (FTypes)

    Attachtment updated:

    - New ByteEx class added;
    - StringEx: new functions added
    - Minor fixes and improvements

  5. #5
    Fanatic Member
    Join Date
    Aug 2016
    Posts
    673

    Lightbulb Re: VB6 Build-in types extension library (FTypes)

    good ider ...

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Jul 2015
    Location
    Poland (moved away from Belarus)
    Posts
    110

    Re: VB6 Build-in types extension library (FTypes)

    Quote Originally Posted by xxdoc123 View Post
    good ider ...
    Hopefully it will help people to write dayly routines concerning types "vice-versa" faster and increase code readability. I started to use it within my current project also. At least at start I eliminated lots of code lines and optimized some loops for strings.

    After some days a new version of FTypes will be available - with powerfull ArrayEx class

  7. #7
    Hyperactive Member
    Join Date
    Jun 2011
    Posts
    461

    Re: VB6 Build-in types extension library (FTypes)

    Great, keep it up!
    I have some suggestions, though. Can you make a support for Currency type of the variable, later extending that on its Decimal subtype (which is poorly supported by native numeric functions in VBA/6)? Also, it would be great if StringEx can be used for numerical operations too, i.e. for storing very big numbers (for which there's no possibility to fit them even into Currency) and doing calculations with them (addition, subtraction, division, multiplication).

    P.S. A word in the title is a bit wrong spelled - it should write "built-in".
    Last edited by MikiSoft; Oct 31st, 2016 at 08:27 PM.

  8. #8

    Thread Starter
    Lively Member
    Join Date
    Jul 2015
    Location
    Poland (moved away from Belarus)
    Posts
    110

    Re: VB6 Build-in types extension library (FTypes)

    Quote Originally Posted by MikiSoft View Post
    Great, keep it up!
    I have some suggestions, though. Can you make a support for Currency type of the variable, later extending that on its Decimal subtype (which is poorly supported by native numeric functions in VBA/6)? Also, it would be great if StringEx can be used for numerical operations too, i.e. for storing very big numbers (for which there's no possibility to fit them even into Currency) and doing calculations with them (addition, subtraction, division, multiplication)?

    P.S. A word in the title is a bit wrong spelled - it should write "built-in".
    Hi ) Thank you for your ideas - i will try to include this features after I will handle ArrayEx functionality (now it is can only bring info about array - almost nothing more). Also I will include a base of Currency type in next version (+ Single type).

    P.S. since i'm not a native english speaker - sorry for mistake in topic header

  9. #9
    Hyperactive Member
    Join Date
    Jun 2011
    Posts
    461

    Re: VB6 Built-in types extension library (FTypes)

    No problem, I'm also not native English speaker.
    I'm thinking of joining all familiar non-float variable types (Byte, Integer, Long...) into one - Number, and on the other side all float types into Float, or even both combined into only one - would be also an good idea. So, you would just have to pass a number (either in String or Variant form) to it/them and the parsing routine "automagically" will decide in which type of variable to store it.
    Last edited by MikiSoft; Oct 31st, 2016 at 08:41 PM.

  10. #10

    Thread Starter
    Lively Member
    Join Date
    Jul 2015
    Location
    Poland (moved away from Belarus)
    Posts
    110

    Re: VB6 Built-in types extension library (FTypes)

    I would say that for some particular purpose that could be good idea, but not for FTypes. The reason is that a GOD object is not good from architectual point of view and also from performance side. I can say 100% is that FType library will follow strong type model as much as possible. At least for now numeric types have Parse & convert methods that can be used.

    But as next steps I can think of common interface to be able to add some kind of additional Numeric class that can parse a value and return needed type.

  11. #11

    Thread Starter
    Lively Member
    Join Date
    Jul 2015
    Location
    Poland (moved away from Belarus)
    Posts
    110

    Re: VB6 Built-in types extension library (FTypes)

    Attachment updated:

    Ftype 1.1.0 (see topic header for details)
    Last edited by hwoarang; Nov 30th, 2016 at 01:42 PM.

  12. #12

    Thread Starter
    Lively Member
    Join Date
    Jul 2015
    Location
    Poland (moved away from Belarus)
    Posts
    110

    Re: VB6 Built-in types extension library (FTypes)

    Attachment updated:

    Ftype 1.3.0 (see topic header for details). Lots of work was done with ArrayEx ... and new methods are to be added soon too.
    Last edited by hwoarang; Nov 30th, 2016 at 01:42 PM.

  13. #13

    Thread Starter
    Lively Member
    Join Date
    Jul 2015
    Location
    Poland (moved away from Belarus)
    Posts
    110

    Re: VB6 Built-in types extension library (FTypes)

    Attachment updated:

    FTypes 1.4.0 (see topic header for details). There is now a possibility to work with decimal numbers and achieve high precision.

  14. #14

    Thread Starter
    Lively Member
    Join Date
    Jul 2015
    Location
    Poland (moved away from Belarus)
    Posts
    110

    Re: VB6 Built-in types extension library (FTypes)

    Attachment updated:

    FTypes 1.4.1 (see topic header for details). Documentation included.

  15. #15

    Thread Starter
    Lively Member
    Join Date
    Jul 2015
    Location
    Poland (moved away from Belarus)
    Posts
    110

    Re: VB6 Built-in types extension library (FTypes)

    Attachment updated:

    FTypes 1.4.2 (see topic header for details).

  16. #16

    Thread Starter
    Lively Member
    Join Date
    Jul 2015
    Location
    Poland (moved away from Belarus)
    Posts
    110

    Re: VB6 Built-in types extension library (FTypes)

    Attachment updated:

    FTypes 1.4.3 (see topic header for details). Lots of fixes for ArrayEx class - now it is stable and usable !

  17. #17
    Lively Member
    Join Date
    Aug 2016
    Posts
    112

    Re: VB6 Built-in types extension library (FTypes)

    Lovely. I will try this out.

  18. #18

    Thread Starter
    Lively Member
    Join Date
    Jul 2015
    Location
    Poland (moved away from Belarus)
    Posts
    110

    Re: VB6 Built-in types extension library (FTypes)

    Attachment updated:

    FTypes 1.5.4 (see topic header for details).
    Last edited by hwoarang; Feb 18th, 2017 at 02:55 PM.

  19. #19
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    9,817

    Re: VB6 Built-in types extension library (FTypes)

    hwoarang,

    This is all an interesting idea, but here's a problem I just don't think you're going to overcome.

    Example #1:

    Code:
    
    Option Explicit
    
    Private Sub Form_Load()
        Dim lIndex As Long
        Dim nStart As Single
        Dim nEnd As Single
    
    
        Dim lToIncrement As Long
    
    
    
        nStart = Timer
        For lIndex = 1 To 10000000
            lToIncrement = lToIncrement + 1
        Next lIndex
        nEnd = Timer
    
    
        MsgBox nEnd - nStart
        Debug.Print nEnd - nStart
    
        Unload Me
    End Sub
    
    
    And the output (seconds to execute):

    Code:
     0.3242188
    And then, we use your stuff, as shown in how lToIncrement is declared. I even initialized it to remove the overhead of initially instantiating the COM object from the timing.

    Code:
    
    Option Explicit
    
    Private Sub Form_Load()
        Dim lIndex As Long
        Dim nStart As Single
        Dim nEnd As Single
    
    
        Dim lToIncrement As LongEx
        Set lToIncrement = New LongEx
        lToIncrement = -1
        lToIncrement = 0
    
    
    
        nStart = Timer
        For lIndex = 1 To 10000000
            lToIncrement = lToIncrement + 1
        Next lIndex
        nEnd = Timer
    
    
        MsgBox nEnd - nStart
        Debug.Print nEnd - nStart
    
        Unload Me
    End Sub
    
    This time, our output is (seconds):

    Code:
     5.480469
    This is over a 16 times reduction in performance. In most situations, this type of performance hit just isn't going to be acceptable.

    I suppose there are specific situations where "enhanced" types may be useful, but one should be aware of this rather dramatic performance hit when using these.

    Just as an FYI, when using the native types, they operate rather directly with memory and the CPU. However, when using a class, you must navigate through the class addressing everytime you use one of its properties (even if it's the default property). There's just no way around this. And the above is even using early-binding.

    If we were to use late-binding (such as using 'As Variant' or 'As Object' in our declaration), things would even get another order of magnitude worse, as follows:

    Code:
    
    Option Explicit
    
    Private Sub Form_Load()
        Dim lIndex As Long
        Dim nStart As Single
        Dim nEnd As Single
    
    
        Dim lToIncrement As Object
        Set lToIncrement = New LongEx
        lToIncrement = -1
        lToIncrement = 0
    
    
    
        nStart = Timer
        For lIndex = 1 To 10000000
            lToIncrement = lToIncrement + 1
        Next lIndex
        nEnd = Timer
    
    
        MsgBox nEnd - nStart
        Debug.Print nEnd - nStart
    
        Unload Me
    End Sub
    
    
    This time, the output is (seconds):

    Code:
     57.06641
    ... over a 175 times decrease in performance, entirely unacceptable.

    Again, a nice idea, but certainly not viable for a complete replacement for the built-in types.

    Best Regards,
    Elroy
    Last edited by Elroy; Feb 11th, 2017 at 01:03 PM.
    Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.

  20. #20

    Thread Starter
    Lively Member
    Join Date
    Jul 2015
    Location
    Poland (moved away from Belarus)
    Posts
    110

    Re: VB6 Built-in types extension library (FTypes)

    Hi Elroy.

    The code you've posted has nothing common with the idea of FTypes - I'm sorry. Moreover, your sample is sensless there. Because for anyone who is about to use Ftypes like this - the will always be a performance leaks (i'm also will not speak about late binding ...). The idea is to make less code lines when for example .. you need to convert Long to Integer and then get high word ... anything that Ftypes support - doesn't matter. The performance is not about to be discussed for people like me and you - guess who knows what are things about in VB6.

    But .. for your particular case I just did a Sub for incrementing that acts less than 0.5 of a second.

    If you want a performance increase - there is a StringEx Concat and rest methods that are much faster than pure VB string opertions. Guess you looked at code already and there is no need to comment.

    Anyway, thatnk you for your post. At least I will add special math methods for maximum time safe in cases like self + and -.

  21. #21
    Registered User
    Join Date
    Feb 2017
    Posts
    1

    Re: VB6 Built-in types extension library (FTypes)

    I try the Samples, and find #3 is not working well.
    I modify it, and this time,it produces 355

    MsgBox a.Create(vbLong, 2&, Array(0&, 4&), Array(0&, 8&)).Add(b).Item(4, 9)

  22. #22

    Thread Starter
    Lively Member
    Join Date
    Jul 2015
    Location
    Poland (moved away from Belarus)
    Posts
    110

    Re: VB6 Built-in types extension library (FTypes)

    Quote Originally Posted by winkey88@163.com View Post
    I try the Samples, and find #3 is not working well.
    I modify it, and this time,it produces 355

    MsgBox a.Create(vbLong, 2&, Array(0&, 4&), Array(0&, 8&)).Add(b).Item(4, 9)
    Yes. Thank you. This was a mistake =)

  23. #23

    Thread Starter
    Lively Member
    Join Date
    Jul 2015
    Location
    Poland (moved away from Belarus)
    Posts
    110

    Re: VB6 Built-in types extension library (FTypes)

    Attachment updated:

    FTypes 1.5.5 (see topic header for details). NOTE: this version is not binary compatible with previous versions.

  24. #24

    Thread Starter
    Lively Member
    Join Date
    Jul 2015
    Location
    Poland (moved away from Belarus)
    Posts
    110

    Re: VB6 Built-in types extension library (FTypes)

    Attachment updated:

    FTypes 1.5.6 (see topic header for details).

  25. #25

    Thread Starter
    Lively Member
    Join Date
    Jul 2015
    Location
    Poland (moved away from Belarus)
    Posts
    110

    Re: VB6 Built-in types extension library (FTypes)

    Attachment updated:

    FTypes 1.5.7 (see topic header for details). NOTE: this version is not binary compatible with previous versions.

  26. #26

    Thread Starter
    Lively Member
    Join Date
    Jul 2015
    Location
    Poland (moved away from Belarus)
    Posts
    110

    Re: VB6 Built-in types extension library (FTypes)

    Full documentation available now (see link above FTypes.zip download). PDF format. With table of content (if supported by viewer) & working links. 3.47 Mb size.

  27. #27

    Thread Starter
    Lively Member
    Join Date
    Jul 2015
    Location
    Poland (moved away from Belarus)
    Posts
    110

    Re: VB6 Built-in types extension library (FTypes)

    Attachment updated:

    FTypes 1.5.8
    (see topic header for details). NOTE: this version is not binary compatible with previous versions, but starting from this point backward compatibility will remain.

  28. #28

    Thread Starter
    Lively Member
    Join Date
    Jul 2015
    Location
    Poland (moved away from Belarus)
    Posts
    110

    Re: VB6 Built-in types extension library (FTypes)

    Attachment updated:

    FTypes 1.5.9 (see topic header for details).

  29. #29

    Thread Starter
    Lively Member
    Join Date
    Jul 2015
    Location
    Poland (moved away from Belarus)
    Posts
    110

    Re: VB6 Built-in types extension library (FTypes)

    Attachment updated:

    FTypes 1.6.0 (see topic header for details).

  30. #30

    Thread Starter
    Lively Member
    Join Date
    Jul 2015
    Location
    Poland (moved away from Belarus)
    Posts
    110

    Re: VB6 Built-in types extension library (FTypes)

    Attachment updated:

    FTypes 1.6.1 (see topic header for details). Note: ArrayEx.Sort method is planned to be introduced in next version.
    Last edited by hwoarang; Mar 1st, 2017 at 02:17 PM.

  31. #31

    Thread Starter
    Lively Member
    Join Date
    Jul 2015
    Location
    Poland (moved away from Belarus)
    Posts
    110

    Re: VB6 Built-in types extension library (FTypes)

    Attachment updated:

    FTypes 1.6.2 (see topic header (samples, rev. history and manual) for details).

  32. #32

    Thread Starter
    Lively Member
    Join Date
    Jul 2015
    Location
    Poland (moved away from Belarus)
    Posts
    110

    Re: VB6 Built-in types extension library (FTypes)

    Attachment updated:

    FTypes 1.6.3 (see topic header for details).

  33. #33

    Thread Starter
    Lively Member
    Join Date
    Jul 2015
    Location
    Poland (moved away from Belarus)
    Posts
    110

    Re: VB6 Built-in types extension library (FTypes)

    Attachment updated:

    FTypes 1.6.4 (see topic header for details + sample #6).

  34. #34
    Member
    Join Date
    Feb 2014
    Posts
    32

    Re: VB6 Built-in types extension library (FTypes)

    Good work. I'll keep testing and use it.

  35. #35

    Thread Starter
    Lively Member
    Join Date
    Jul 2015
    Location
    Poland (moved away from Belarus)
    Posts
    110

    Re: VB6 Built-in types extension library (FTypes)

    Quote Originally Posted by Simos View Post
    Good work. I'll keep testing and use it.
    Thanks a lot) Hope lib helps with daily code routines.

  36. #36

    Thread Starter
    Lively Member
    Join Date
    Jul 2015
    Location
    Poland (moved away from Belarus)
    Posts
    110

    Re: VB6 Built-in types extension library (FTypes)

    Attachment updated:

    FTypes 1.6.5 (see topic header for details).

  37. #37
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,371

    Re: VB6 Built-in types extension library (FTypes)

    What about a Change event? So when the extended variable is declared like "Private WithEvents" it raises an event "Change", but only when the value gets effectively changed.

    Example:
    Code:
    Private WithEvents bTest As BooleanEx
    Private bAnother As Boolean
    
    Sub DoTest()
    bTest = Not bTest ' Will raise event
    bTest = bTest ' No change, do not raise
    End Sub
    
    Private Sub bTest_Change()
    bAnother = bTest
    End Sub

  38. #38

    Thread Starter
    Lively Member
    Join Date
    Jul 2015
    Location
    Poland (moved away from Belarus)
    Posts
    110

    Re: VB6 Built-in types extension library (FTypes)

    Surprise =) Currently working on it (exactly same mechanism in another private project). Hope to release new version of FLib soon (one-two weeks maybe) with events, interfaces and ArrayEx extensions.

  39. #39

    Thread Starter
    Lively Member
    Join Date
    Jul 2015
    Location
    Poland (moved away from Belarus)
    Posts
    110

    Re: VB6 Built-in types extension library (FTypes)

    Hi guys. Any notes, bugs or else maybe ?

  40. #40
    PowerPoster
    Join Date
    Sep 2012
    Posts
    2,083

    Re: VB6 Built-in types extension library (FTypes)

    Thanks for sharing. I haven't used it yet, but it looks pretty good, especially ArrayEx and StringEx. When I have time, I'll test it.

    I have seen a MinFrameWork(Vibian) on PsCode. It is a simple but powerful COM library for VB6 which emulates/bring some VB.NET functions. Here is its link, may be helpful to you and others:
    http://www.planet-source-code.com/vb...01715423264095

    I guess maybe someone will use VB6 to simulate all .NET class libraries. That would be a very interesting thing.

Page 1 of 3 123 LastLast

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