Page 1 of 2 12 LastLast
Results 1 to 40 of 45

Thread: The most lacking language feature in VB6

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2020
    Posts
    1,445

    The most lacking language feature in VB6

    Most people might think that the most lacking thing in VB6 is "class inheritance". But in the process of converting some other languages (such as C#, C++, JS) into VB6, I found that the language feature that is most lacking in VB6 is actually "logic short-circuit".

    The lack of "logic short-circuit" in VB6 made it very painful for me to translate other languages to VB6. E.g:

    Code:
    if (aa && bb && cc && dd) { } 
    
    // 
    
    if (aa || bb || cc || dd) { }
    
    //
    
    if (aa && (bb || cc) && dd || ee && ff) { }
    Another feature that VB6 lacks is try-catch-finally (Try...Catch...Finally...End Try). The lack of try-catch-finally makes the structure of the translated VB6 code very confusing.

    What do you think about this?

  2. #2
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: The most lacking language feature in VB6

    I think 1998 is a long time past.

  3. #3
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,600

    Re: The most lacking language feature in VB6

    Careful, you're starting to sound like me. We all know how that turns out eventually.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  4. #4

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2020
    Posts
    1,445

    Re: The most lacking language feature in VB6

    Quote Originally Posted by Niya View Post
    Careful, you're starting to sound like me. We all know how that turns out eventually.
    No, I'm completely different from you. I'm looking for the optimal solution under limited conditions.

    Edit:
    In other words, I'm trying to explore the potential of VB6 as much as possible, not abandon it.
    Last edited by SearchingDataOnly; May 26th, 2022 at 07:50 PM.

  5. #5
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,600

    Re: The most lacking language feature in VB6

    Fair enough. Carry on soldier
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  6. #6
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    5,708

    Re: The most lacking language feature in VB6

    Lack of 64bit support and unsigned types (besides Byte) is what really gets me down.

    Also lack of true arrays (with the narrow exception of fixed-sized single dimension arrays inside user types, which thankfully makes workarounds for APIs requiring regular arrays possible, although very painful).

  7. #7
    Frenzied Member
    Join Date
    Dec 2012
    Posts
    1,476

    Re: The most lacking language feature in VB6

    What would be a real time saver would be byte arrays that could be handled like strings (data + length as a single printable variable).

    J.A. Coutts

  8. #8
    The Idiot
    Join Date
    Dec 2014
    Posts
    2,730

    Re: The most lacking language feature in VB6

    a few things.
    to check if an array is empty or not without the need to error trapping or API usage.

    ArrayLen()

    that return the count (not the lbound), so even if I Dim as MyArr(0) is will return as 1

    Add a new Paint() Event that will trigger each monitor frequency.
    so if the monitor is set to 60hz, this will trigger 60 times a second.
    we can use it instead of a timer and use it to draw to the form whatever we want.
    and together with this an Option that will tell the program to "only" use redraw at that point.
    so if you draw something and call a ".PSet" it will only draw as that frequency. (kind of double buffering)

    a built-in mp3 player and built-in png load/save.

  9. #9
    Hyperactive Member
    Join Date
    Mar 2019
    Posts
    426

    Re: The most lacking language feature in VB6

    Quote Originally Posted by baka View Post
    a few things.
    to check if an array is empty or not without the need to error trapping or API usage.

    ArrayLen()
    Code:
    Public Function actionArrayDimensioned(action() As actionArray) As Long
    
    10        On Error GoTo errorHandler
    
    20        If Not Not action Then
    
    30           actionArrayDimensioned = UBound(action)
    
    40        Else
    
    50           actionArrayDimensioned = -1
    
    60        End If
    
    70        Exit Function
    
    80        actionArrayDimensioned = -1
    
    90        actionArrayDimensioned = UBound(action)
    
    100       Exit Function
    
    errorHandler:
    
    110       Resume endofitall
    
    endofitall:
    
    End Function

  10. #10
    Hyperactive Member
    Join Date
    Mar 2019
    Posts
    426

    Re: The most lacking language feature in VB6

    I am on the unsigned variable side. Also lack of multi threading support in ordinary code without api gymnastics

  11. #11
    The Idiot
    Join Date
    Dec 2014
    Posts
    2,730

    Re: The most lacking language feature in VB6

    vbwins, "Not Not" is dangerous. it can mess up with the code.
    do not use that at all.
    and what u are doing is exactly error trapping, something I don't want.

    I already have this

    Code:
    Function IsArray(ByVal vPtr As Long) As Boolean
        Dim vt As Long
    
        CopyMemory vt, ByVal vPtr, 4
        If vt > 0 Then CopyMemory IsArray, ByVal vt, 2
    End Function
    that works with UDT arrays as well, not just long/byte/variant etc
    just string array I still need error trapping for it to work properly.

    Code:
    Function IsArrayStr(ByRef Arr() As String) As Boolean
        On Error Resume Next
        IsArrayStr = UBound(Arr)
        If Err.Number = 0 Then IsArrayStr = True
    End Function
    Last edited by baka; May 27th, 2022 at 06:29 AM.

  12. #12
    Addicted Member
    Join Date
    Oct 2011
    Posts
    179

    Re: The most lacking language feature in VB6

    Quote Originally Posted by couttsj View Post
    What would be a real time saver would be byte arrays that could be handled like strings (data + length as a single printable variable).

    J.A. Coutts
    Code:
    Private Sub Command1_Click()
        Dim s As String
        Dim b() As Byte
        
        s = "Testing it"
        b = s
        Me.Print b
    End Sub

  13. #13
    Addicted Member
    Join Date
    Oct 2011
    Posts
    179

    Re: The most lacking language feature in VB6

    Quote Originally Posted by vbwins View Post
    Code:
    Public Function actionArrayDimensioned(action() As actionArray) As Long
    
    10        On Error GoTo errorHandler
    
    20        If Not Not action Then
    
    30           actionArrayDimensioned = UBound(action)
    
    40        Else
    
    50           actionArrayDimensioned = -1
    
    60        End If
    
    70        Exit Function
    
    80        actionArrayDimensioned = -1
    
    90        actionArrayDimensioned = UBound(action)
    
    100       Exit Function
    
    errorHandler:
    
    110       Resume endofitall
    
    endofitall:
    
    End Function
    What is the idea of sending to resume to the end of the procedure when it is already just before the end of the procedure?

  14. #14
    Frenzied Member
    Join Date
    Jun 2015
    Posts
    1,068

    Re: The most lacking language feature in VB6

    unsigned vars and 64 bit values can be solved in a pretty seamlessly C compliant way with a couple extra classes

  15. #15
    PowerPoster wqweto's Avatar
    Join Date
    May 2011
    Location
    Sofia, Bulgaria
    Posts
    5,152

    Re: The most lacking language feature in VB6

    Quote Originally Posted by argen View Post
    What is the idea of sending to resume to the end of the procedure when it is already just before the end of the procedure?
    Probably something similar to what lines 80 and 90 do in the snippet above while being unreachable.

    Btw, the function does not work reliably when in Break on All Errors debug session toggle (which everyone should use by default)

    cheers,
    </wqw>

  16. #16
    Addicted Member
    Join Date
    Oct 2011
    Posts
    179

    Re: The most lacking language feature in VB6

    Quote Originally Posted by wqweto View Post
    Probably something similar to what lines 80 and 90 do in the snippet above while being unreachable.
    Yes.

    Quote Originally Posted by wqweto View Post
    (which everyone should use by default)

  17. #17
    Frenzied Member
    Join Date
    Dec 2012
    Posts
    1,476

    Re: The most lacking language feature in VB6

    Quote Originally Posted by argen View Post
    Code:
    Private Sub Command1_Click()
        Dim s As String
        Dim b() As Byte
        
        s = "Testing it"
        b = s
        Me.Print b
    End Sub
    That basically changes the byte array to a 16 bit string. I need the 8 bit array to be treated like a string.
    Code:
    Private Sub Command1_Click()
        Dim s As String
        Dim b() As Byte
        s = "Testing it"
        b = s
        DebugPrintByte s, b
        Debug.Print b
        Debug.Print
        b = HexToByte("54657374696E67206974")
        DebugPrintByte s, b
        Debug.Print b
    End Sub
    Testing it:
    54 00 65 00 73 00 74 00 69 00 6E 00 67 00 20 00
    69 00 74 00
    Testing it

    Testing it:
    54 65 73 74 69 6E 67 20 69 74
    ?????

    J.A. Coutts

  18. #18
    Addicted Member
    Join Date
    Oct 2011
    Posts
    179

    Re: The most lacking language feature in VB6

    Quote Originally Posted by couttsj View Post
    That basically changes the byte array to a 16 bit string. I need the 8 bit array to be treated like a string.
    It changes nothing, VB strings are 16 bits (two bytes).

    8 bits strings are a thing of the (distant) past. However you can use StrConv if you need 8 bits (ANSI) strings.

    Code:
    Private Sub Command1_Click()
        Dim s As String
        Dim b() As Byte
        
        s = "Testing it"
        b = StrConv(s, vbFromUnicode)
        ' Me.Print b
    End Sub

  19. #19
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,600

    Re: The most lacking language feature in VB6

    Quote Originally Posted by couttsj View Post
    That basically changes the byte array to a 16 bit string. I need the 8 bit array to be treated like a string.
    You should not be doing this in 2022. The only thing today that even resembles an 8 bit character format is UTF-8 and that should be handled by Unicode-aware functions that can recognize UTF-8 encoding. Windows itself uses UTF-16 which is a 16 bit character format. You will save yourself a whole lot of trouble handling them as they are instead of trying to convert them to ANSI or ASCII.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  20. #20
    Frenzied Member
    Join Date
    Dec 2012
    Posts
    1,476

    Re: The most lacking language feature in VB6

    You guys are very much missing the point. I did not say I wanted to handle byte arrays as strings, I said I wanted to handle them LIKE strings. Instead of me having to translate byte arrays back and forth between arrays and hex strings, it would be a real time saver to simply debug print byte arrays as a single variable. To create a string array is straight forward, but to create an array of byte arrays not so straight forward.

    J.A. Coutts

  21. #21
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    5,708

    Re: The most lacking language feature in VB6

    Quote Originally Posted by baka View Post
    vbwins, "Not Not" is dangerous. it can mess up with the code.
    do not use that at all.
    and what u are doing is exactly error trapping, something I don't want.

    I already have this

    Code:
    Function IsArray(ByVal vPtr As Long) As Boolean
        Dim vt As Long
    
        CopyMemory vt, ByVal vPtr, 4
        If vt > 0 Then CopyMemory IsArray, ByVal vt, 2
    End Function
    that works with UDT arrays as well, not just long/byte/variant etc
    just string array I still need error trapping for it to work properly.

    Code:
    Function IsArrayStr(ByRef Arr() As String) As Boolean
        On Error Resume Next
        IsArrayStr = UBound(Arr)
        If Err.Number = 0 Then IsArrayStr = True
    End Function
    That will work with arrays *of* UDTs, but be careful, it will not work with fixed-size 1D arrays *within* a UDT, because those are not SAFEARRAYs. You'll actually run into a potential app crash if you try it, because you're presumably using VarPtr() which simply returns the address of the first member - 20, which may be an address outside your app that will result in a crash when you try to read it.

  22. #22
    The Idiot
    Join Date
    Dec 2014
    Posts
    2,730

    Re: The most lacking language feature in VB6

    and why would u check fixed arrays? thats just a waste of code.
    I have been using that for years. and if its fails, returning 0 it will not try to read the Dims.

  23. #23
    Addicted Member
    Join Date
    Oct 2011
    Posts
    179

    Re: The most lacking language feature in VB6

    Quote Originally Posted by couttsj View Post
    You guys are very much missing the point. I did not say I wanted to handle byte arrays as strings, I said I wanted to handle them LIKE strings. Instead of me having to translate byte arrays back and forth between arrays and hex strings, it would be a real time saver to simply debug print byte arrays as a single variable. To create a string array is straight forward, but to create an array of byte arrays not so straight forward.

    J.A. Coutts
    I agree then.

  24. #24
    Hyperactive Member
    Join Date
    Jan 2018
    Posts
    268

    Re: The most lacking language feature in VB6

    An easy method of defining lightweight private (non-COM) classes.
    Alternatively, more capability for UDTs (adding to collections, access by reference)

  25. #25
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    5,708

    Re: The most lacking language feature in VB6

    Quote Originally Posted by baka View Post
    and why would u check fixed arrays? thats just a waste of code.
    I have been using that for years. and if its fails, returning 0 it will not try to read the Dims.
    Sometimes people default to e.g. using the UBound for loops in all cases, and don't change the way they do it for a single specific case.

    Failure in that scenario, depending on the address it tries to read, it could return 0, an arbitrary 2-byte value, or crash the app. If you passed it ArrPtr(udt.fixedarray).

  26. #26
    The Idiot
    Join Date
    Dec 2014
    Posts
    2,730

    Re: The most lacking language feature in VB6

    I use the function myself. its not a universal fix for inexperienced people.
    I actually only using it when "saving" the massive UDT to disc. theres a couple of dynamic arrays that I need to know if they are used to convert into raw-data.
    with everything, you need to know how to use it properly, misuse can always cause issues.

    example how I use it:

    Code:
    If IsArray(ArrPtr(.Slot)) Then
       lbyte = UBound(.Slot)
       AddByte lbyte
       For n = 0 To lbyte
          For l = 0 To 30
             AddInteger .Slot(n).id(l)
          Next l
       Next n
    Else
       lbyte = 255
       AddByte lbyte
    End If
    also u say nothing about Not Not, that will cause glitches to the code. that should be a cause of concern.
    Last edited by baka; May 28th, 2022 at 04:41 AM.

  27. #27
    PowerPoster yereverluvinuncleber's Avatar
    Join Date
    Feb 2014
    Location
    Norfolk UK (inbred)
    Posts
    2,250

    Re: The most lacking language feature in VB6

    My single desire is more advanced graphics and transparencies at all levels. Despite all the other language/environment deficiencies this one change would bring it into the 21st century and make it much more usable to the average user that could use VB6. I could live with all the other deficiencies.

    The native ability to make windowless forms with no title nor slide bars, no minimise and close buttons. Transparent forms support natively, ie. background = transparent with no kludges such as the "maroon = transparent" kludge. Full 'skinability' to items such as slidebars/trackbars, including colours, images and fonts. Full support for image objects with transparencies (PNGs) capable of acting as buttons or similar controls with all associated events. Native support of PNG and more modern image formats.

    Providing true transparency for all objects, not just to the form below but to any underlying objects, opacity = 0 - 255.
    https://github.com/yereverluvinunclebert

    Skillset: VMS,DOS,Windows Sysadmin from 1985, fault-tolerance, VaxCluster, Alpha,Sparc. DCL,QB,VBDOS- VB6,.NET, PHP,NODE.JS, Graphic Design, Project Manager, CMS, Quad Electronics. classic cars & m'bikes. Artist in water & oils. Historian.

    By the power invested in me, all the threads I start are battle free zones - no arguing about the benefits of VB6 over .NET here please. Happiness must reign.

  28. #28
    PowerPoster yereverluvinuncleber's Avatar
    Join Date
    Feb 2014
    Location
    Norfolk UK (inbred)
    Posts
    2,250

    Re: The most lacking language feature in VB6

    and native, safe, easy to use, multithreading and marshalling...
    https://github.com/yereverluvinunclebert

    Skillset: VMS,DOS,Windows Sysadmin from 1985, fault-tolerance, VaxCluster, Alpha,Sparc. DCL,QB,VBDOS- VB6,.NET, PHP,NODE.JS, Graphic Design, Project Manager, CMS, Quad Electronics. classic cars & m'bikes. Artist in water & oils. Historian.

    By the power invested in me, all the threads I start are battle free zones - no arguing about the benefits of VB6 over .NET here please. Happiness must reign.

  29. #29
    Addicted Member
    Join Date
    Oct 2011
    Posts
    179

    Re: The most lacking language feature in VB6

    Quote Originally Posted by ahenry View Post
    An easy method of defining lightweight private (non-COM) classes.
    Alternatively, more capability for UDTs (adding to collections, access by reference)
    Yes, that would be very important.

  30. #30
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,253

    Re: The most lacking language feature in VB6

    Quote Originally Posted by yereverluvinuncleber View Post
    My single desire is more advanced graphics and transparencies at all levels. Despite all the other language/environment deficiencies this one change would bring it into the 21st century and make it much more usable to the average user that could use VB6. I could live with all the other deficiencies.

    The native ability to make windowless forms with no title nor slide bars, no minimise and close buttons. Transparent forms support natively, ie. background = transparent with no kludges such as the "maroon = transparent" kludge. Full 'skinability' to items such as slidebars/trackbars, including colours, images and fonts. Full support for image objects with transparencies (PNGs) capable of acting as buttons or similar controls with all associated events. Native support of PNG and more modern image formats.

    Providing true transparency for all objects, not just to the form below but to any underlying objects, opacity = 0 - 255.
    All of that (and more) is available for years now (via RC5/RC6).

    Below comes the minimal-code for an example, which shows how you can produce an executable,
    which fires up a transparent Form (which shows an "Alpha-Image-Resource" as its BackGround):

    Into a Module (switch your Project-Settings, to "Start from Sub Main()"):
    Code:
    Option Explicit
    
    Public Const Transp_WithTaskbarEntry = 6, Transp_WithoutTaskbarEntry = 7
    
    Sub Main()
      Cairo.ImageList.AddIconFromResourceFile "imgBG", "shell32", 167 'pre-load a resource-Alpha-image
     
      Dim Form As cWidgetForm
      Set Form = Cairo.WidgetForms.Create(Transp_WithTaskbarEntry, "Transp-Form", True, 128, 128)
          Form.CenterOn New_c.Displays(1)
          Form.WidgetRoot.ImageKey = "imgBG"
     
      Form.Show vbModal 'use Alt+F4 to close it (or close it via the Taskbar-Menu)
    End Sub
    That's easy enough, I guess (just adapt to your own BG-Images, which can be PNGs or SVGs).

    Now, if you want to place your own Child-Widgets on such a Form, you will have to "write your own Classes".
    (you will have to learn VB6-Classes though - and also how to "expose Events on Classes" and also the "WithEvents-Keyword").

    Let's say, you want to expand the above Mini-Example, about your first, own "self-rendered ImageButton"
    (e.g. to offer "Form-Closing" also via Mouse-Interaction)...

    Then add a Class, named cwImgButton to your Project (which currently contains only a *.bas-Module)
    Code:
    Option Explicit
    
    '**** default-codeparts in any Widget-Class
    Private WithEvents W As cWidgetBase
    
    Private Sub Class_Initialize()
      Set W = Cairo.WidgetBase
    End Sub
    Public Property Get Widgets() As cWidgets: Set Widgets = W.Widgets: End Property
    Public Property Get Widget() As cWidgetBase: Set Widget = W: End Property
    '**** end of default-codeparts *****
    
    Private Sub W_Click()
      If W.Key = "btnClose" Then W.Root.WidgetForm.Unload 'close the Parent-Form of this Button
    End Sub
    
    Private Sub W_MouseEnter(ByVal MouseLeaveWidget As RC6.cWidgetBase)
      W.Refresh 'to implement Hover-Effects, we just have to ensure a W.Refresh here (which triggers the Paint-Event)
    End Sub
    Private Sub W_MouseLeave(ByVal MouseEnterWidget As RC6.cWidgetBase)
      W.Refresh 'to implement Hover-Effects, we just have to ensure a W.Refresh here (which triggers the Paint-Event)
    End Sub
    
    Private Sub W_Paint(CC As RC6.cCairoContext, ByVal xAbs As Single, ByVal yAbs As Single, ByVal dx_Aligned As Single, ByVal dy_Aligned As Single, UserObj As Object)
      If W.MouseOver Then CC.Paint 0.5, Cairo.CreateSolidPatternLng(W.HoverColor) 'react to Hovering, by drawing a semi-transparent background below the following Img-rendering-call
      CC.RenderSurfaceContent W.ImageKey, 0, 0, W.Width, W.Height
    End Sub
    Ok, that's the code for an ImageButton-Widget(Class) - the only part that's misssing is "adding that Widget to a Form"
    (the enhancments of the Sub Main() routine from above, are in blue):
    Code:
    Option Explicit
    
    Public Const Transp_WithTaskbarEntry = 6, Transp_WithoutTaskbarEntry = 7
    
    Sub Main()
      Cairo.ImageList.AddIconFromResourceFile "imgBG", "shell32", 167 'pre-load a resource-Alpha-image
      Cairo.ImageList.AddIconFromResourceFile "imgClose", "shell32", 240 'pre-load another one for the ImgBtn-Widget
      
      Dim Form As cWidgetForm
      Set Form = Cairo.WidgetForms.Create(Transp_WithTaskbarEntry, "Transp-Form", True, 128, 128)
          Form.CenterOn New_c.Displays(1)
          Form.WidgetRoot.ImageKey = "imgBG"
          
      Dim ImgBtn As cwImgButton
      Set ImgBtn = Form.Widgets.Add(New cwImgButton, "btnClose", Form.Width - 24, 0, 24, 24)
          ImgBtn.Widget.ImageKey = "imgClose"
          
      Form.Show vbModal 'use Alt+F4 to close it (or close it via the Taskbar-Menu)
    End Sub
    And that's it:
    - a transparent Form (with an exchangeable Alpha-Image as BackGround)
    - hosting a Child-Widget (as an ImgButton, that also allows an Alpha-Image as its BackGround)

    None of the so called "modern languages" will make this any easier than demonstrated here (in just two code-modules)...

    Olaf

  31. #31
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,600

    Re: The most lacking language feature in VB6

    Quote Originally Posted by Schmidt View Post
    None of the so called "modern languages" will make this any easier than demonstrated here (in just two code-modules)...
    WPF can do stuff like this naturally and as a bonus it's hardware accelerated since it uses the DirectX pipeline for it's own rendering operations.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  32. #32
    PowerPoster PlausiblyDamp's Avatar
    Join Date
    Dec 2016
    Location
    Pontypool, Wales
    Posts
    2,473

    Re: The most lacking language feature in VB6

    Quote Originally Posted by Niya View Post
    WPF can do stuff like this naturally and as a bonus it's hardware accelerated since it uses the DirectX pipeline for it's own rendering operations.
    In fact the entire XAML for this would be
    Code:
    <Window x:Class="MainWindow"
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
            xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
            xmlns:local="clr-namespace:WpfApp1VB"
            mc:Ignorable="d"
            Title="MainWindow" Height="523" Width="858" AllowsTransparency="True" WindowStyle="None">
        <Window.Background>
            <ImageBrush ImageSource="/Global-Warming-PNG-Clipart.png"/>
        </Window.Background>
        <Button HorizontalAlignment="Left" Height="143" Margin="383,328,0,0" VerticalAlignment="Top" Width="229">
            <Button.Background>
                 <ImageBrush ImageSource="/sample.png"/>
            </Button.Background>
        </Button>
    </Window>
    Images are from https://www.risingground.org/wp-cont.../08/sample.png and https://www.pngall.com/global-warmin...download/16389.

    This would look like the attached image

    Name:  2022-05-28_18-23-58.jpg
Views: 295
Size:  47.4 KB

    which is in front of the VS code window. The burning planet is the form background, and the "Sample" is the button.

  33. #33
    PowerPoster wqweto's Avatar
    Join Date
    May 2011
    Location
    Sofia, Bulgaria
    Posts
    5,152

    Re: The most lacking language feature in VB6

    I think you might by missing a namespace (or two) in this XAML snippet, no? It's lacking some verbosity there. . .

    cheers,
    </wqw>

  34. #34
    PowerPoster PlausiblyDamp's Avatar
    Join Date
    Dec 2016
    Location
    Pontypool, Wales
    Posts
    2,473

    Re: The most lacking language feature in VB6

    Quote Originally Posted by wqweto View Post
    I think you might by missing a namespace (or two) in this XAML snippet, no? It's lacking some verbosity there. . .

    cheers,
    </wqw>
    It is a straight cut and paste from the code window behind the running app. In fact VS is showing the xmlns:local namespace as being unused as well.

  35. #35

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2020
    Posts
    1,445

    Re: The most lacking language feature in VB6

    Quote Originally Posted by baka View Post
    Add a new Paint() Event that will trigger each monitor frequency.
    so if the monitor is set to 60hz, this will trigger 60 times a second.
    we can use it instead of a timer and use it to draw to the form whatever we want.
    and together with this an Option that will tell the program to "only" use redraw at that point.
    so if you draw something and call a ".PSet" it will only draw as that frequency. (kind of double buffering)
    Wondering if there is a similar feature in .Net, maybe Niya can explain.

  36. #36

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2020
    Posts
    1,445

    Re: The most lacking language feature in VB6

    Quote Originally Posted by PlausiblyDamp View Post
    In fact the entire XAML for this would be
    Code:
    <Window x:Class="MainWindow"
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
            xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
            xmlns:local="clr-namespace:WpfApp1VB"
            mc:Ignorable="d"
            Title="MainWindow" Height="523" Width="858" AllowsTransparency="True" WindowStyle="None">
        <Window.Background>
            <ImageBrush ImageSource="/Global-Warming-PNG-Clipart.png"/>
        </Window.Background>
        <Button HorizontalAlignment="Left" Height="143" Margin="383,328,0,0" VerticalAlignment="Top" Width="229">
            <Button.Background>
                 <ImageBrush ImageSource="/sample.png"/>
            </Button.Background>
        </Button>
    </Window>
    I'm wondering if there is an easier way to achieve something similar to what XAML/WPF does above. IMO, XAML is flexible and powerful, but not friendly.

  37. #37
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,600

    Re: The most lacking language feature in VB6

    Quote Originally Posted by SearchingDataOnly View Post
    Wondering if there is a similar feature in .Net, maybe Niya can explain.
    WinForms applications in .Net use GDI+ and work by the same mechanisms as the UI systems in VB6. However, WPF applications are powered by DirectX so they are a little different. Baka is more knowledgeable about DirectX than I am. If DirectX has some kind of callback interface or something for syncing drawing operations on the monitor's refresh rate, WPF applications might be able to tap into this.
    Last edited by Niya; May 29th, 2022 at 11:52 PM.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  38. #38
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,600

    Re: The most lacking language feature in VB6

    Quote Originally Posted by SearchingDataOnly View Post
    I'm wondering if there is an easier way to achieve something similar to what XAML/WPF does above. IMO, XAML is flexible and powerful, but not friendly.
    All this really comes down to is imperative programming vs declarative. VB6, C#, C++, Python etc are imperative languages. XAML, HTML and the text you find in .FRM VB6 files are declarative languages. The general consensus is that declarative languages are better for describing UIs than imperative languages. The essence of a declarative language like XAML or HTML is that you tell the computer what something should look like instead of how to do it. There is absolutely no reason you can't come up with your own simpler declarative language for describing UIs.

    Here is a nice little article on the topic of declarative languages vs imperative languages.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  39. #39

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2020
    Posts
    1,445

    Re: The most lacking language feature in VB6

    Quote Originally Posted by Niya View Post
    All this really comes down to is imperative programming vs declarative. VB6, C#, C++, Python etc are imperative languages. XAML, HTML and the text you find in .FRM VB6 files are declarative languages. The general consensus is that declarative languages are better for describing UIs than imperative languages. The essence of a declarative language like XAML or HTML is that you tell the computer what something should look like instead of how to do it. There is absolutely no reason you can't come up with your own simpler declarative language for describing UIs.

    Here is a nice little article on the topic of declarative languages vs imperative languages.
    What do you think of the following way?
    Code:
        With New FormBuilder
            .AddXML "<Window Class='MainWindow' Title='MainWindow' Height='523' Width='858' AllowsTransparency='True' WindowStyle='None'>"
            .AddXML "    <Window.Background>"
            .AddXML "        <ImageBrush ImageSource='/Global-Warming-PNG-Clipart.png'/>"
            .AddXML "    </Window.Background>"
            .AddXML "    <Button HorizontalAlignment='Left' Height='143' Margin='383,328,0,0' VerticalAlignment='Top' Width='229'>"
            .AddXML "        <Button.Background>"
            .AddXML "             <ImageBrush ImageSource='/sample.png'/>"
            .AddXML "        </Button.Background>"
            .AddXML "    </Button>"
            .AddXML "</Window>"
            
            .Show vbModal
        End With
    IMO, Olaf should easily provide the above solution in RC6. I would also like to implement the above declarative programming on my scripting language.

    Also, XML seems to be more concise, clearer, and more object-oriented than JSON when it comes to describing UI.
    Last edited by SearchingDataOnly; May 31st, 2022 at 07:40 AM.

  40. #40
    PowerPoster wqweto's Avatar
    Join Date
    May 2011
    Location
    Sofia, Bulgaria
    Posts
    5,152

    Re: The most lacking language feature in VB6

    Quote Originally Posted by SearchingDataOnly View Post
    IMO, Olaf should easily provide the above solution in RC6. I would also like to implement the above declarative programming on my scripting language.
    If it's so easy for Olaf to impl this (in your opinion) then by transitivity it should be at least as easy to provide such declarative XAML support in your scripting language too.

    cheers,
    </wqw>

Page 1 of 2 12 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