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

Thread: [RESOLVED] Obtain Form Size in Millimeters

  1. #1

    Thread Starter
    Member
    Join Date
    Jul 2008
    Posts
    41

    Resolved [RESOLVED] Obtain Form Size in Millimeters

    I am trying to obtain the true size of a form on screen in millimeters.

    I am testing using a borderless form, with:
    Width = ScaleWidth = 5670
    Height = ScaleWidth = 5670

    So using the value of 567 twips per logical centimeter, I expect the form to measure 100mm on the screen,however it appears to be around 81mm?
    What am i missing here?
    I am running at 96DPI on Win 7.

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

    Re: Obtain Form Size in Millimeters

    Code:
    Private Sub Form_Load()
     Me.BorderStyle = 0
     Me.Width = 5670
     Me.Height = 5670
     Debug.Print Me.ScaleX(ScaleWidth, Me.ScaleMode, vbMillimeters) ' 100.0126
     Debug.Print Me.ScaleY(ScaleHeight, Me.ScaleMode, vbMillimeters) '100.0126
     
    End Sub

  3. #3
    Sinecure devotee
    Join Date
    Aug 2013
    Location
    Southern Tier NY
    Posts
    6,582

    Re: Obtain Form Size in Millimeters

    What you get on the screen should rarely be a true size in millimeters, but rather a logical size in millimeters, since the physical dimensions of the screen itself can differ. For instance, I have a 1920x1080 screen that is 24 inches, and another screen that is also 1920x1080 resolution, but is 42 inches. The one signal is feeding both the 24 inch screen and the 42 inch screen. The size of the form can't visually be the same size in millimeters obviously.
    And if I was using a projector, the physical size of the image would depend on the distance the projector was from the projection, so the size in millimeters would differ.

    Even the logical millimeters conversion will be different depending on the DPI setting you have Windows set to, which doesn't have to match the true dpi of the monitor you're using. In your particular case, it could be a matter of your having the Display Properties "Size of text, ..." set to 125% as the difference between 81 and 100 millimeters is close to that scale difference.
    Last edited by passel; Nov 20th, 2017 at 08:35 AM.

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

    Re: Obtain Form Size in Millimeters

    Here's a comment I have in a particular function related to this:

    Code:
    
        ' This was designed to be used for graphic manipulation, but it will work for any purpose.
        '
        ' At present, the following ScaleModeConstants are supported:
        '   vbCentimeters
        '   vbMillimeters
        '   vbInches
        '   vbHimetric
        '   vbPixels      There's also a new DIP: Device-Independent Pixels.  A DIP is defined as 1/96th of a logical inch.  96 DIPs per inch (by definition).
        '   vbPoints
        '   vbTwips
        '   Picas (vbPicas = 99, defined below)
        ' All else returns zero.
        '
        ' There are also ScaleX and ScaleY methods for PictureBoxes and Forms.
        ' These are useful for converting the vbUser ScaleMode to one of the others.
        ' However, a Form or PictureBox is needed to use these.
        '
        ' 2.54 centimeters per inch.  25.4 millimeters per inch.  This is an international definition.
        ' 1000 HiMetrics per centimeter.  100 HiMetrics per millimeter.
        ' 1440 twips per inch.
        ' 567 twips per centimeter.
        ' 72 points per inch.
        ' 20 twips per point.
        ' 6 picas per inch.    12 points per pica.   240 twips per pica.
        ' Pixels are specific to the screen, and not specific to inches or centimeters.
        ' PIXELS are the ONLY one specific to the screen.  ALL others are relative based on DPI (basically, pixels per inch).
        '
        ' To convert from/to pixels, the DPI (dots per inch) setting must be known.
        ' Standard is 96DPI for both x and y.
        '
        ' At 96DPI, 1 pixel = 15 twips, 1440/96.
        ' At 96DPI, 1 pixel = ~26.46 himetrics, (1000 * 2.54) / 96
    
    
    Along with the ScaleX and ScaleY stuff above, this should give you about all you need. Also, you can use the above info to build a function that would convert independent of any hDC or hWnd, if you wanted. You'd still need a TwipsPerPixel though, but I can get that via API if need be.

    Enjoy,
    Elroy
    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.

  5. #5
    Fanatic Member Spooman's Avatar
    Join Date
    Mar 2017
    Posts
    868

    Re: Obtain Form Size in Millimeters

    Quote Originally Posted by passel View Post
    The one signal is feeding both the 24 inch screen and the 42 inch screen. The size of the form can't visually be the same size in millimeters obviously.
    So, are you saying that if the resolution is the same on each, and a form is 12 inches wide on the 24 inch screen, it will be 21 inches wide on the 42 inch screen?

    I'd have thought it would be 12 inches wide on each.

    Spoo

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

    Re: Obtain Form Size in Millimeters

    Set the screen DPI for each monitor to its physical size. That's exactly why we now have per-monitor DPI in Windows 8.1 and Windows 10.

    Of course if you duplicate the display on multiple monitors then that doesn't help. I'm not sure how anything can.

  7. #7
    Sinecure devotee
    Join Date
    Aug 2013
    Location
    Southern Tier NY
    Posts
    6,582

    Re: Obtain Form Size in Millimeters

    Quote Originally Posted by Spooman View Post
    So, are you saying that if the resolution is the same on each, and a form is 12 inches wide on the 24 inch screen, it will be 21 inches wide on the 42 inch screen?

    I'd have thought it would be 12 inches wide on each.

    Spoo
    I was considering the case where the video signal is split, as is the case we often have when presenting a larger display to an audience.
    You're thinking of the case, as dilettante pointed out, where the second monitor is an extension of the desktop, so its drawing and DPI is independent of the other monitor.
    I still think the 81 to 100 variation looks suspiciously like the display mode was set to 125%, but seems like it would be the reverse case, i.e. the form would display larger, 125 instead of 100. I'm probably off in a few ways since I usually don't deal with DPI issues on a regular basis.

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

    Re: Obtain Form Size in Millimeters

    I'm pulling together code to answer this question, but it's turning out to be quite the problem.

    I've pretty much got it together, but it's still not going to be complete. The one piece I don't have worked out is when you have different DPI settings per monitor (which you can do since Windows 8.1).

    I'm going to have some lunch, but I'll post my work in a bit.

    Here are some of the things that must be considered:

    • Which monitor is the form on?
    • What's the actual size (width and height) of the monitor?
    • What's the DPI setting for that specific monitor?


    Once you've got that sorted, the rest is just math.

    Regards,
    Elroy

    EDIT1: Also, some other things that may complicate things are:
    • Info in a manifest.
    • Compatibility settings.
    Last edited by Elroy; Nov 20th, 2017 at 02:12 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.

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

    Re: Obtain Form Size in Millimeters

    Ok, lunch isn't quite ready and I've got a first pass of doing it:

    Form1 test code (with a Command1 button):

    Code:
    
    Option Explicit
    '
    
    Private Sub Command1_Click()
        Dim hMonitor As Long
        Dim nMonWidthMM As Single
        Dim nMonHeightMM As Single
        Dim lMyPelWidth As Long
        Dim lMyPelHeight As Long
        Dim lMonPelsWidth As Long
        Dim lMonPelsHeight As Long
        Dim nMyWidthMM As Single
        Dim nMyHeightMM As Single
    
        hMonitor = MonitorHandleForHwnd(Me.hWnd)
        nMonWidthMM = MonitorWidthMM(hMonitor)
        nMonHeightMM = MonitorHeightMM(hMonitor)
        '
        lMyPelWidth = Me.Width / Screen.TwipsPerPixelX
        lMyPelHeight = Me.Height / Screen.TwipsPerPixelY
        '
        lMonPelsWidth = MonitorWidthPx(hMonitor)
        lMonPelsHeight = MonitorHeightPx(hMonitor)
        '
        nMyWidthMM = lMyPelWidth * nMonWidthMM / lMonPelsWidth
        nMyHeightMM = lMyPelHeight * nMonHeightMM / lMonPelsHeight
        '
        MsgBox "My width (mm): " & Format$(nMyWidthMM, "#0") & vbCrLf & _
               "My height (mm): " & Format$(nMyHeightMM, "#0")
    End Sub
    
    

    Code for a BAS module:

    Code:
    
    Option Explicit
    '
    Public Type RECT
        Left   As Long
        Top    As Long
        Right  As Long ' This is +1 (right - left = width)
        Bottom As Long ' This is +1 (bottom - top = height)
    End Type
    Private Type MONITORINFO
        cbSize As Long
        rcMonitor As RECT
        rcWork As RECT
        dwFlags As Long
    End Type
    Private Type MONITORINFOEX
        cbSize As Long
        rcMonitor As RECT
        rcWork As RECT
        dwFlags As Long
        szDevice As String * 32
    End Type
    Private Type DISPLAY_DEVICEW
       cbSize As Long
       DeviceName(0 To 63) As Byte
       DeviceString(0 To 255) As Byte
       StateFlags As Long
       DeviceID(0 To 255) As Byte
       DeviceKey(0 To 255) As Byte
    End Type
    '
    Public Enum HKeyEnum
        HKEY_CLASSES_ROOT = &H80000000
        HKEY_CURRENT_USER = &H80000001
        HKEY_LOCAL_MACHINE = &H80000002
        HKEY_USERS = &H80000003
        HKEY_PERFORMANCE_DATA = &H80000004
        HKEY_CURRENT_CONFIG = &H80000005
        HKEY_DYN_DATA = &H80000006
    End Enum
    #If False Then ' Intellisense fix.
        Public HKEY_CLASSES_ROOT, HKEY_CURRENT_USER, HKEY_LOCAL_MACHINE, HKEY_USERS, HKEY_PERFORMANCE_DATA, HKEY_CURRENT_CONFIG, HKEY_DYN_DATA
    #End If
    Private Const READ_CONTROL = &H20000
    Private Const SYNCHRONIZE = &H100000
    Private Const STANDARD_RIGHTS_READ = (READ_CONTROL)
    Private Const KEY_QUERY_VALUE = &H1
    Private Const KEY_CREATE_SUB_KEY = &H4
    Private Const KEY_ENUMERATE_SUB_KEYS = &H8
    Private Const KEY_NOTIFY = &H10
    Private Const KEY_READ = ((STANDARD_RIGHTS_READ Or KEY_QUERY_VALUE Or KEY_ENUMERATE_SUB_KEYS Or KEY_NOTIFY) And (Not SYNCHRONIZE))
    Private Const ERROR_SUCCESS = 0&
    '
    Public Declare Sub CopyMemory Lib "kernel32.dll" Alias "RtlMoveMemory" (ByRef Dest As Any, ByRef Source As Any, ByVal Bytes As Long)
    Private Declare Function RegOpenKeyEx Lib "advapi32" Alias "RegOpenKeyExW" (ByVal HKEY As Long, ByVal ptrToSubKey As Long, ByVal ulOptions As Long, ByVal samDesired As Long, ByRef phkResult As Long) As Long
    Private Declare Function RegQueryValueEx Lib "advapi32" Alias "RegQueryValueExW" (ByVal HKEY As Long, ByVal lpszValueName As Long, ByVal lpReserved As Long, ByRef lpType As Long, ByVal ptrToData As Long, ByRef lpcbData As Long) As Long
    Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal HKEY As Long) As Long
    Private Declare Function EnumDisplayDevices Lib "user32" Alias "EnumDisplayDevicesW" (ByVal ptrToDeviceName As Long, ByVal iDevNum As Long, ByRef lpDisplayDevice As DISPLAY_DEVICEW, ByVal dwFlags As Long) As Long
    Private Declare Function GetMonitorInfo Lib "user32.dll" Alias "GetMonitorInfoA" (ByVal hMonitor As Long, ByRef lpmi As MONITORINFO) As Long
    Private Declare Function GetMonitorInfoEx Lib "user32.dll" Alias "GetMonitorInfoA" (ByVal hMonitor As Long, ByRef lpmi As MONITORINFOEX) As Long
    Private Declare Function MonitorFromWindow Lib "user32.dll" (ByVal hWnd As Long, ByVal dwFlags As Long) As Long
    '
    Dim giTemp() As Long
    '
    
    Public Function MonitorWidthPx(hMonitor As Long) As Long
        ' If you just have the number, do: MonitorWidthPx(MonitorWidthPx(MonitorNum))
        Dim uMonInfo As MONITORINFO
        uMonInfo.cbSize = LenB(uMonInfo)
        If GetMonitorInfo(hMonitor, uMonInfo) = 0 Then Exit Function
        MonitorWidthPx = uMonInfo.rcMonitor.Right - uMonInfo.rcMonitor.Left
    End Function
    
    Public Function MonitorHeightPx(hMonitor As Long) As Long
        ' If you just have the number, do: MonitorHeightPx(MonitorWidthPx(MonitorNum))
        Dim uMonInfo As MONITORINFO
        uMonInfo.cbSize = LenB(uMonInfo)
        If GetMonitorInfo(hMonitor, uMonInfo) = 0 Then Exit Function
        MonitorHeightPx = uMonInfo.rcMonitor.Bottom - uMonInfo.rcMonitor.Top
    End Function
    
    Public Function MonitorHandleForHwnd(hWnd As Long) As Long
        Const MONITOR_DEFAULTTONULL = &H0
        MonitorHandleForHwnd = MonitorFromWindow(hWnd, MONITOR_DEFAULTTONULL)
    End Function
    
    Public Function MonitorWidthMM(hMonitor As Long) As Single
        ' Returns ZERO if not found or not available for some reason.
        Dim bbEDID() As Byte
        '
        If Not MonitorEDID(hMonitor, bbEDID) Then Exit Function
        MonitorWidthMM = ((bbEDID(68) And &HF0) * 16) + bbEDID(66)
    End Function
    
    Public Function MonitorHeightMM(hMonitor As Long) As Single
        ' Returns ZERO if not found or not available for some reason.
        Dim bbEDID() As Byte
        '
        If Not MonitorEDID(hMonitor, bbEDID) Then Exit Function
        MonitorHeightMM = ((bbEDID(68) And &HF) * 256) + bbEDID(67)
    End Function
    
    Public Function MonitorEDID(hMonitor As Long, bbEDID() As Byte) As Boolean
        ' Extended Display Identification Data (EDID).
        ' All kinds of information is provided in the EDID.
        ' A good resource is: https://en.wikipedia.org/wiki/Extended_Display_Identification_Data
        '
        ' Given a registry path (created from a monitor's device ID), retrieve a corresponding EDID.
        ' Returns: TRUE if the EDID is found, else FALSE.
        ' The actual EDID is returned in bbEDID().  Be careful, it's not dimensioned if not found.
        Dim hReg As Long
        Dim iRet As Long
        Dim iSize As Long
        Dim sReg As String
        Dim sRegPath As String
        '
        Const HKEY_LOCAL_MACHINE As Long = &H80000002 ' EDID data is stored in the local machine branch; note that WRITING values here requires admin access, but QUERYING does not.
        Const KEY_QUERY_VALUE As Long = &H1& ' To avoid UAC, we must only use QUERY access rights.
        '
        sRegPath = MonitorRegKeyPart(hMonitor)
        If Len(sRegPath) = 0 Then Exit Function
        '
        ' Use the substrings to create a path to the EDID location inside the registry
        sRegPath = "System\CurrentControlSet\Enum\Display\" & sRegPath & "\Device Parameters"
        '
        ' Before we can retrieve the EDID, we first have to open its registry key.  Get a handle to the key (if possible).
        iRet = RegOpenKeyEx(HKEY_LOCAL_MACHINE, StrPtr(sRegPath), 0&, KEY_QUERY_VALUE, hReg)
        'The registry key was opened successfully.  Use it to query the actual value at that location.
        If (iRet = 0&) And (hReg <> 0&) Then
            ' Before retrieving the array itself, we need to determine its size.
            sReg = "EDID"
            iRet = RegQueryValueEx(hReg, StrPtr(sReg), 0&, ByVal 0&, ByVal 0&, iSize)
            ' Size was retrieved successfully.  Dimension the array and receive the EDID data.
            ' EDIDs should never be shorter than 128 bytes.
            ' Newer versions of the spec allow *longer* than 128, but 128 is the minimum.
            If (iRet = 0&) And (iSize >= 128&) Then
                ReDim bbEDID(0 To iSize - 1)
                iRet = RegQueryValueEx(hReg, StrPtr(sReg), 0&, 0&, VarPtr(bbEDID(0)), iSize)
                If iRet = 0& Then MonitorEDID = True
            End If
        End If
        If Not MonitorEDID Then Erase bbEDID
        If hReg Then RegCloseKey hReg
    End Function
    
    Public Function MonitorRegKeyPart(hMonitor As Long) As String
        ' This returns the two key parts (concatenated) to get the monitor's registry info.
        ' it should be prefaced with "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\DISPLAY\" for use.
        ' Neither a preceeding nor following \ is returned.
        ' Empty string is returned if it can't be found.
        Dim i As Long
        Dim sDevID As String
        Dim sArray() As String
        Dim sInternalName As String
        Dim InfoDetailed As DISPLAY_DEVICEW
        '
        sInternalName = MonitorInternalName(hMonitor)
        If Len(sInternalName) = 0 Then Exit Function
        '
        InfoDetailed.cbSize = LenB(InfoDetailed)
        If EnumDisplayDevices(StrPtr(sInternalName), 0&, InfoDetailed, 1&) = 0& Then Exit Function
        '
        sDevID = String$(128, 0)
        CopyMemory ByVal StrPtr(sDevID), ByVal VarPtr(InfoDetailed.DeviceID(0)), 256
        i = InStr(sDevID, vbNullChar)
        If i Then sDevID = Left$(sDevID, i - 1)
        If Len(sDevID) = 0 Then Exit Function
        ' We need to parse out various bits of the device ID in order to construct a registry path where the EDID lies.
        ' The substrings we need are delimited by pound signs, so make sure at least one exists.
        If InStr(sDevID, "#") = 0 Then Exit Function
        ' Parse the device ID into discrete substrings.
        sArray = Split(sDevID, "#")
        ' Make sure we generated enough substrings to correctly generate a registry path.
        If UBound(sArray) < 2 Then Exit Function
        '
        MonitorRegKeyPart = sArray(1) & "\" & sArray(2)
    End Function
    
    Public Function MonitorInternalName(hMonitor As Long) As String
        ' This is an internal name that isn't good for much.
        ' If you just have the number, do: MonitorInternalName(MonitorHandle(MonitorNum))
        '
        ' Need to check that cbSize = Len(uMonInfoEx) is correct.
        '
        Dim i As Long
        Dim uMonInfoEx As MONITORINFOEX
        uMonInfoEx.cbSize = Len(uMonInfoEx)
        If GetMonitorInfoEx(hMonitor, uMonInfoEx) = 0 Then Exit Function
        MonitorInternalName = uMonInfoEx.szDevice
        i = InStr(MonitorInternalName, vbNullChar)
        If i Then MonitorInternalName = Left$(MonitorInternalName, i - 1)
    End Function
    
    
    I'm on a high-end laptop with Win10-64 bit, and a large external monitor. And this seems to work on either monitor. I actually measured the form.

    Also, this won't work on older OSs. It probably needs Windows 8.1 or later. Dilettante can probably answer that question better than me.

    I didn't use that MonitorDpiSetting function, as I couldn't get a call to GetDpiForMonitor working. The calls to TwipsPerPixelX and TwipsPerPixelY aren't going to work correctly under some circumstances, and they should be avoided, which requires getting that MonitorDpiSetting up and running.

    Enjoy,
    Elroy

    EDIT1: Cleaned up the BAS code and removed some superfluous code.
    Last edited by Elroy; Nov 21st, 2017 at 10:53 AM.
    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.

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

    Re: Obtain Form Size in Millimeters

    Hmmm, okay, lunch is in belly, and I just tested the above with my larger monitor with scale set at 125%, and everything still works fine. So, maybe I'm done.

    Now, changing the Win10 scaling it's exactly the same thing as changing the older DPI. However, I'm thinking that the old DPI should be left alone (at 96).

    I tested my MonitorWidthPx and MonitorHeightPx at different scalings, and it seems to always reflect the changes. So, we're good to go.

    EDIT1: @sabbath69: Basically, what you missed is that everything you're looking at is "virtual" to some degree. And these days, with the new Win10 scaling, we've even got layers of what level of "virtual" we're talking about. But it can be sorted out.

    If we leave the old-style DPI at 96, which we always should since Windows 10 now has superior virtualization with the scaling. Therefore, if we do this, we're back to only one level of "virtual", the scaling level versus the physical monitor size.

    Now, you actually can get the physical monitor size. It's not easy and it's not always guaranteed to work, but that's what my MonitorWidthMM and MonitorHeightMM functions are doing. They dig deep into the registry and dig something out called the EDID (with more info here) about each of the monitors. With this, the exact dimension of the monitors can be known. And then, with a little math, we can figure it out.
    Last edited by Elroy; Nov 20th, 2017 at 08:33 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.

  11. #11

    Thread Starter
    Member
    Join Date
    Jul 2008
    Posts
    41

    Re: Obtain Form Size in Millimeters

    Thanks to everyone for the valued comments, and special thanks to Elroy for the great code. I will give this a run and see how it goes then come back to you.
    Yes I had forgotten about the physical size component (silly me - should've figured that one out)

  12. #12

    Thread Starter
    Member
    Join Date
    Jul 2008
    Posts
    41

    Re: Obtain Form Size in Millimeters

    Many thanks again to Elroy for great code, however I made this fail several times on different computers, especially VMs. The Registry entries contained either no values or BAD value for the Monitor EDID.
    As a result of not being able to reliably use this method I have now abandoned it.

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

    Re: [RESOLVED] Obtain Form Size in Millimeters

    Hi Sabbath69,

    Yes, to do what you ask, you've got to know the "physical" dimensions of the monitor. If you can't get that, you can't do it. The only way I know to get those dimensions is to look for the EDID or to possibly "ask" for them And you are quite correct ... many monitors (and many situations) aren't going to give you EDID information. However, for ones that do, the above code should work.

    Good Luck,
    Elroy
    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.

  14. #14
    Fanatic Member
    Join Date
    Aug 2013
    Posts
    806

    Re: [RESOLVED] Obtain Form Size in Millimeters

    Elroy, the EDID retrieval code you shared in post #9 is directly copied from my work here and here. Even the comments match verbatim. It is frustrating to see it re-posted with its original license and attribution stripped.

    @sabbath69: EDID retrieval is indeed fraught with pitfalls. The registry retrieval technique is technically supported all the way back to Vista, but as you've seen, VMs wreak havoc with it. This makes sense, given that users can resize a VM window and thus change the "physical size" available to the display. (Something you can't do with a physical display.)

    When I've had to make this work in the past, I've provided a back-up page where the user can manually enter display dimensions. This is far from elegant, but I don't know of any other workaround to support VMs.
    Check out PhotoDemon, a pro-grade photo editor written completely in VB6. (Full source available at GitHub.)

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

    Re: [RESOLVED] Obtain Form Size in Millimeters

    Hi Tanner,

    I apologize vehemently. I truly didn't mean to deny you any credit. I've just been at this for so many decades and gathered and written so much code, that I do lose track of where it came from. As is the case for (dare I say) all of us, our continuing work is always on the shoulders of giants (including yourself).

    Maybe this is wrong of me, but as a "borrowed" piece of code slowly works its way into my primary code-base, I do tend to rework it (indentation, comments, variable names, etc) into my way of doing things. And again, maybe this is wrong, but I just feel that my code would be too cluttered if I attempted to guarantee attribution to every single line of code.

    Tanner, have no doubt ... I view you as an extremely fine programmer. Your Photo Demon is a shining example of that, and it does many "photo" things I haven't seen done in any other open source VB6 program. It's truly an excellent piece of work.

    Again, please accept my apologies. And, to everyone else: Yes, Tanner is the one who first educated me about the EDID, and his work is highly influential on anything I do with the EDID.

    Best Regards,
    Elroy
    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.

  16. #16
    Fanatic Member
    Join Date
    Aug 2013
    Posts
    806

    Re: [RESOLVED] Obtain Form Size in Millimeters

    Elroy, I appreciate your apology and kindness. I know these things are not meant with ill-intent, but my concern here is less about credit for my work and more with the VB6 ecosystem as a whole. That's why I have to be firm: this idea that "my code would be too cluttered if I attempted to guarantee attribution to every single line of code" is wrong. Full stop. This is why open-source efforts in VB6 continue to be a non-starter, and why developers like Olaf are right to not release their code. This is also why the open-source community sees the VB6 community as toxic.

    Licensing and copyright can be inconvenient. That doesn't mean they can be ignored.

    If you copy+paste whole blocks of code into your project, that work does not become yours. It is still the original author's. Any copyright belongs to them. Gradual changes over time don't negate this. If I copy a whole Harry Potter chapter into a book I write, but I rename the characters (variables), change the chapter title (function definition), and pick a different font (style and indentation?), I still can't claim the chapter as my own. I would own my little changes, yes, but there is not some magic threshold where the original owner's license and copyright "disappears". (Unless you explicitly get the original author's permission to create a derivative work.)

    If you want to use existing source code without attribution, you have two options - ask the developer to grant explicit permission, or use clean-room engineering to design and build an alternative implementation. (Although clean-room engineering technically isn't possible if you've already seen someone else's code. You'd need to use other developers in a Chinese wall.)

    If you haven't seen source code and you only have a rough idea of how a developer does something (e.g. "he finds an EDID in the registry, then manually parses it for display dimensions"), then by all means, write your own implementation and avoid the need for attribution. Competing implementations are great for everyone!

    But if you involve the copy/paste menus, you must attribute - especially when the code carries an explicit license!

    As VB6 developers, none of us are perfect at this - myself included - but we must do better. Otherwise, we will continue to have talented developers that never open-source their work, and we'll have no one to blame for this but ourselves.
    Check out PhotoDemon, a pro-grade photo editor written completely in VB6. (Full source available at GitHub.)

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

    Re: [RESOLVED] Obtain Form Size in Millimeters

    Hi Tanner,

    (And first, let me apologize for this hijack of this thread, but I don't know if it'd be seen as widely in another discussion area.)

    I guess I really don't understand. Here's Wikipedia's first sentence where they discuss Open Source:

    Open-source software (OSS) is computer software with its source code made available with a license in which the copyright holder provides the rights to study, change, and distribute the software to anyone and for any purpose.
    Other than when posting in these forums, I attach the GPLv3 to all of my source code, and I see that as the type of "license" that Wikipedia mentions.

    For me, I suppose the only thing that would be very upsetting is if someone were to take my work (basically as a whole, or some major component) and attempt to commercialize it. For me, that would be very un-cool.

    However, even there, if they were to take "snippets" and incorporate it into some commercial application, I wouldn't mind. In fact, there's no doubt it's happened with respect to stuff I've posted in these forums.

    And just to touch on some of your other points....

    * With respect to the VB6 community, I'm truly not sure that we're worse than any other software community. You'll never convince me that Bill Gates didn't virtually wholly steal MS-DOS from Gary Kildall, who wrote the solid CP/M (and MP/M) OS. And I know that the source to CP/M got into the wild, because I used to have a copy (mostly written in PL/M). MS-DOS was no clean-room rewrite either. And that's just one of many examples. Also, I really must take exception to the VB6 community as toxic. If anything, that's just a promotion by Microsoft because we refused to fully endorse .NET. Beyond that, I don't think we're any different than any other software community.

    * I suppose we must also differentiate between "Open Source" and "Source Available" software. Back in the 80's and 90's when I was still selling commercial software, we were forced to provide some of our clients with our source code. However, this was always under strict contract that stated that they understood that all marketing and distribution rights still belonged to us. IMO, this isn't "Open Source" in any sense of the word. I suppose I see Open Source as CopyLefted as opposed to CopyRighted. Once we consider our software to be Open Source, we truly give up our rights to it, other than possibly attempting to prohibit others from "re-Closing the Source". From this perspective, I'm still not clear why Olaf wouldn't "Open" his project if he has no "ideas" about ever commercializing it. (But maybe he will speak to his own reasons.)

    * Regarding your Harry Potter analogy, I completely agree. However, this is not a black-and-white issue. Personally, since I re-made myself into someone who attempts to spend my life being a part of institutions who attempt to make the lives of others (particularly children) better, I've done substantial publishing (of scientific articles). This idea of short passages of text having specific ownership has been shown to be wrong on many occasions (including repeatedly in the courts). Sure, tweaking a 500 page book doesn't circumvent copyright. However, reworking a paragraph into a new work typically does, especially if the context is very different. I'd have to review what I posted but just quickly looking at post #9, I see much of my own work there. And the entire post certainly isn't the Gettysburg Address. Again, I apologize, and I truly wish I had mentioned your name as a major contributor when I originally posted it. But there is some gray here.

    Tanner, please, I think you're a great guy, and I hear your concerns. I truly don't want to start some big row over this.

    Best Regards,
    Elroy

    EDIT1 (after reading your PM): Hey Tanner. I wish it were possible to look you in the eye, smile, shake your hand, and then offer to buy you lunch. Who knows, maybe someday. (Olive Garden be okay?) You take care.
    Last edited by Elroy; Dec 6th, 2017 at 12:23 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.

  18. #18
    Fanatic Member
    Join Date
    Aug 2013
    Posts
    806

    Re: [RESOLVED] Obtain Form Size in Millimeters

    I don't want this message to get lost in the weeds, and I don't want my own poor explanations to cloud things. So let me just cite the simplest explanation I've seen: MIT's instructions for writing code.

    When should I cite a source in my code?

    • When you copy code from an external source. Whether you are copying a snippet of code or an entire module, you should credit the source.
    • When you copy the code and adapt it, you should still credit the source. You were not the original developer of the code.


    How should I cite the code?

    • Generally, the URL and the date of retrieval are sufficient. Add more details if it will help the reader get a clearer understanding of the source.
    • If you adapted the code, you should indicate “Adapted from:” or “Based on” so it is understood that you modified the code.
    Additional instructions are given for open-source projects, and they're exactly what you'd except: obey all license terms, basically.

    I have never worked for (or with) a company or contractor, from any country, whose policies differ from this. I have, however, seen plenty of contractors and employees fired (or more commonly, never hired in the first place) if they deviate from these rules in their own software. If your online presence contains any un-attributed code - which is very easy to detect these days - that's an immediate deal-breaker for every company I've ever worked for. No one will risk employees who ignore software licenses.

    Finally, I want to continue to stress that this isn't about egos or feelings or personal preferences. This is simply how open-source works. What if sabbath69 had found a bug in the code shared in post #9? For all I know, there are dozens of copies of that code spread across who-knows-how-many projects. Without attribution, those fixes never make it back to me, and in turn, they never get propagated out to the other developers who rely on that code in production environments.

    All the benefits of open-source go out the window if copyright and licensing terms are not propagated across copy+paste instances. Open-source is about more than just providing easy-to-use snippets for people. (Or massaging egos.) It's about working together as a hive-mind to improve everyone's code.

    This is why attribution is so critical. All it takes is one line of code - a single comment! - to rectify the problem. I just don't see this as an egregious burden, and years of (trying to) do it correctly in my own projects has never negatively impacted my productivity. If anything, it's saved my hide countless times when I encounter a bug and I need to figure out where the hell a piece of code came from.

    (And frankly, it upsets me that I have to use hundreds of sentences to defend the inclusion of a one-line comment attribution in copy+pasted code. This is what I mean by the VB6 community being toxic to open-source efforts. In any other language I've worked in, a mention of "hey, that code isn't yours" is immediately rectified, no questions asked. But here, that's seen as too much work. I can't tell you how frustrating it is to have to defend coding practices that are taught on the first day of every CS course. )
    Check out PhotoDemon, a pro-grade photo editor written completely in VB6. (Full source available at GitHub.)

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

    Re: [RESOLVED] Obtain Form Size in Millimeters

    Hi Tanner,

    Let me take another example and see how you've handled it. I'm sure the vast majority of us have made a great deal of use of the WIN32API.TXT document that came with the VB6 IDE. And I'm sure most of us, including myself, and copied-and-pasted many times from this document, including constants, structures (i.e., UDTs), API declarations, and the like. I'm certainly not the one who wrote that document. Am I to site that document in every spot where I've copied-and-pasted code from it?

    Yet another example is code snippets included with the MSDN. Am I to site every occurrence of using (and reworking) those snippets?

    Just Asking,
    Elroy

    EDIT1: Again, I'm truly in agreement with the larger points you're making. However, I do think there must be some reasonableness about it all.
    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
    Fanatic Member
    Join Date
    Aug 2013
    Posts
    806

    Re: [RESOLVED] Obtain Form Size in Millimeters

    I'm sorry, Elroy, but I can't continue with this. I feel like you have a troubling habit of being flagrantly wrong about copyright issues, and even in the face of clear evidence, you take the discussion in circles instead of just saying "I'm sorry, I was wrong, I'll do better." I don't know what else I can say to suggest that code attribution is not just an ethical thing to do, but a practical thing. I never in a million years thought this was something I'd have to justify to another developer.

    If code attribution isn't something you want to do, no one can stop you. It sucks - a lot - for those of us who try our hardest to make VB6 a better language for open-source developers, but I can't waste more time restating the obvious. If you can't see the difference between referencing library API definitions vs copying full modules and functions from independent developers, I don't know what to tell you.

    Just know that it really hurts to hear things like "I admire your work, but not enough to attribute it." If you're doing this with a small set of functions from me, I worry greatly about what you've done to other developers.

    Furthermore, I just don't see how this attitude helps the wider VB6 community, and it strongly deters me from participating in further VB6 open-source efforts. I'm starting to feel like my time is better spent in communities where developers care more about supporting each other, than about the "burden" imposed on them by tiny things like one-line attribution comments. When semantics become more important than mutual respect for each other's work, maybe the battle's already been lost. I don't know. I'm just running out of steam to keep fighting with VB6 devs over things that are a given in other communities.
    Check out PhotoDemon, a pro-grade photo editor written completely in VB6. (Full source available at GitHub.)

  21. #21
    PowerPoster
    Join Date
    Feb 2017
    Posts
    4,996

    Re: [RESOLVED] Obtain Form Size in Millimeters

    Quote Originally Posted by Tanner_H View Post
    Finally, I want to continue to stress that this isn't about egos or feelings or personal preferences.
    I believe it is.
    I don't buy your other reasons.

    Quote Originally Posted by Tanner_H View Post
    (And frankly, it upsets me that I have to use hundreds of sentences to defend the inclusion of a one-line comment attribution in copy+pasted code. This is what I mean by the VB6 community being toxic to open-source efforts. In any other language I've worked in, a mention of "hey, that code isn't yours" is immediately rectified, no questions asked. But here, that's seen as too much work. I can't tell you how frustrating it is to have to defend coding practices that are taught on the first day of every CS course. )
    And then, why don't you adapt yourself to the others?

  22. #22

    Thread Starter
    Member
    Join Date
    Jul 2008
    Posts
    41

    Re: [RESOLVED] Obtain Form Size in Millimeters

    Quote Originally Posted by Tanner_H View Post
    Elroy, the EDID retrieval code you shared in post #9 is directly copied from my work here and here. Even the comments match verbatim. It is frustrating to see it re-posted with its original license and attribution stripped.

    @sabbath69: EDID retrieval is indeed fraught with pitfalls. The registry retrieval technique is technically supported all the way back to Vista, but as you've seen, VMs wreak havoc with it. This makes sense, given that users can resize a VM window and thus change the "physical size" available to the display. (Something you can't do with a physical display.)

    When I've had to make this work in the past, I've provided a back-up page where the user can manually enter display dimensions. This is far from elegant, but I don't know of any other workaround to support VMs.
    Cheers Tanner, yes fraught with Danger!. I used to obtain the screen size from the user, but thought that this was rather antiquated so wanted to move forward. Not knowing this and losing the function that was connected to it, is no big deal anyway in the giant scheme of things, so onward and upward with the rest.

  23. #23
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,219

    Re: [RESOLVED] Obtain Form Size in Millimeters

    Quote Originally Posted by Tanner_H
    Finally, I want to continue to stress that this isn't about egos or feelings or personal preferences.
    Quote Originally Posted by Eduardo- View Post
    I believe it is.
    I don't buy your other reasons.
    FWIW Eduardo, I "buy" Tanners statements fully.

    It is *not-at-all* about ego, it is simply about *frustration*.
    (your comment for example, makes me want "cry out loud" or something - it's so far off from anything which was said so far...).

    Seriously, knowledge about OpenSource-licenses is a *necessity*, when we
    want to accomplish something bigger (as a community) than "coding the next Form".

    Quote Originally Posted by Eduardo- View Post
    And then, why don't you adapt yourself to the others?
    Despite the quite high potential to become a law-breaker that way (violations of OS-licenses did end up in court a few times already) -
    the "general rule" I thought was, that those with next to no knowledge about a topic should adapt to (or aspire to become like)
    those who know significantly more about the thing in question (not the other way round).

    Beside that, it's simple ethics, morals ... down to simply acknowledgment (of somebody),
    or even "simply not being ignorant about things", which play into that topic.

    @Elroy
    E.g. when you write, that "all the software at your customers end" is licensed by you under GPL-V3,
    and you made use of a module from a different developer, who released that code under e.g. BSD,
    then you already "break the law" (or a least "the rules") - because not all OS-licenses are compatible with each other -
    or may not simply be "re-licensed" by yourself (in most cases only the author may do that).

    I don't really get, why a simple:
    "understood, I will try my best and read about it"...
    is so very hard to do (it may take a day or two, but then one has at least a basic understanding)

    What I'd expect (willing to answer and discuss - same goes for Tanner I'm sure) - would be
    a few follow-up-questions about certain things which were not understood (by googling that topic).

    Though such a healthy discussion so far never happened.

    Instead comments like Eduardos seem to be the norm
    (coming across then, as kind of "seeking reassurance in the like-minded, anonymous masses").

    It's not really "uplifting" to comment and "speak up" when such stuff comes up, because one will risk,
    to be immediately painted into the "elitist"-corner, just for telling some things as they really are.

    "Ain't nobody interested in truthfulness anymore"? ( IIRC, that was considered a virtue at some time

    Olaf

  24. #24
    PowerPoster
    Join Date
    Feb 2017
    Posts
    4,996

    Re: [RESOLVED] Obtain Form Size in Millimeters

    Quote Originally Posted by Schmidt View Post
    FWIW Eduardo, I "buy" Tanners statements fully.

    It is *not-at-all* about ego, it is simply about *frustration*.
    (your comment for example, makes me want "cry out loud" or something - it's so far off from anything which was said so far...).

    Seriously, knowledge about OpenSource-licenses is a *necessity*, when we
    want to accomplish something bigger (as a community) than "coding the next Form".



    Despite the quite high potential to become a law-breaker that way (violations of OS-licenses did end up in court a few times already) -
    the "general rule" I thought was, that those with next to no knowledge about a topic should adapt to (or aspire to become like)
    those who know significantly more about the thing in question (not the other way round).

    Beside that, it's simple ethics, morals ... down to simply acknowledgment (of somebody),
    or even "simply not being ignorant about things", which play into that topic.

    @Elroy
    E.g. when you write, that "all the software at your customers end" is licensed by you under GPL-V3,
    and you made use of a module from a different developer, who released that code under e.g. BSD,
    then you already "break the law" (or a least "the rules") - because not all OS-licenses are compatible with each other -
    or may not simply be "re-licensed" by yourself (in most cases only the author may do that).

    I don't really get, why a simple:
    "understood, I will try my best and read about it"...
    is so very hard to do (it may take a day or two, but then one has at least a basic understanding)

    What I'd expect (willing to answer and discuss - same goes for Tanner I'm sure) - would be
    a few follow-up-questions about certain things which were not understood (by googling that topic).

    Though such a healthy discussion so far never happened.

    Instead comments like Eduardos seem to be the norm
    (coming across then, as kind of "seeking reassurance in the like-minded, anonymous masses").

    It's not really "uplifting" to comment and "speak up" when such stuff comes up, because one will risk,
    to be immediately painted into the "elitist"-corner, just for telling some things as they really are.

    "Ain't nobody interested in truthfulness anymore"? ( IIRC, that was considered a virtue at some time

    Olaf
    I'll try to be more clear because I don't want to be misunderstood.

    1) I'm not encouraging anyone to break any law in any sense.

    2) For any source code that I can share anybody can do whathever she/he want to do. Copy/paste in whatever place, don't give any attibution, don't cite any source, it doesn't matter to me. Compile, sell, make a lot of money, good for him.

    3) I'm only concerned about the case were somebody fraudulently claim to be the original author, and if he tries to close the source and legally claim the intellectual property. That's very unlikely to happen anyway.

    3) About others, I know that others have a different position, we don't have another choice than respect their conditions.
    I think that they hurt the spreading of their works in that way, but that is how they put it and we have to respect their wills.

    And my personal opinion about those postures is that it is for vanity. Of course they have the right to have all the vanity that they want, but don't come to me saying bulls**t.

  25. #25
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,219

    Re: [RESOLVED] Obtain Form Size in Millimeters

    Quote Originally Posted by Eduardo- View Post
    2) For any source code that I can share anybody can do whathever she/he want to do. Copy/paste in whatever place, don't give any attibution, don't cite any source, it doesn't matter to me. Compile, sell, make a lot of money, good for him.
    Yep, it's good old UseNet-tradition, that (smaller) code-snippets and examples which were posted
    (with the obvious intent to be helpful) - are "free for all, no strings attached".

    But that's due to the fact, that the code is usually not really voluminous -
    and often "quite near to the standard-usage-examples" (nothing truly inventive really).

    IMO about 95% of the code-examples (also on Plantet-SourceCode) fall into that category -
    (straight forward - but often not really well-written stuff, which is nevertheless useful for beginners or semi-professionals).

    Quote Originally Posted by Eduardo- View Post
    3) About others, I know that others have a different position, we don't have another choice than respect their conditions.
    I think that they hurt the spreading of their works in that way, but that is how they put it and we have to respect their wills.
    Yep, there is (on one hand) that -> respecting their decisions to keep it closed (for whatever reasons) -
    but on the other hand also the fact, that many developers don't really try to understand the reasons,
    why something is kept closed.

    Quote Originally Posted by Eduardo- View Post
    And my personal opinion about those postures is that it is for vanity.
    Of course they have the right to have all the vanity that they want, but don't come to me saying bulls**t.
    Now you are being judgemental and quite rude (not trying at all, "to respect their decision").

    Ok, let's make a simple test now - and see how you react:

    If you'd care to read about (and understand) the goals (I've posted them here often enough) -
    what I want to accomplish with the RIchClient in the end, you'd know that it is a lot of work
    that still remains (to finally come up with a compatible IDE and compiler and new classbased Runtime).

    If you now say:
    "Ok, I find the goals worthwhile and am willing to contribute over at least one year,
    about one hour per day on average, to help you reach that goal for the benfit of all"...

    then I will in turn:
    Immediately send you the current sources of the RichClient (since there's no reason
    not to trust you, is there? - and the sources will be helpful in your "daily contribution to the over-all project").

    BTW, a few developers here already have the sources (because they help, or were helpful in the past).

    So, is the above offer vanity on my part?
    I'd say not - and am quite sure that on the other hand, you will now weasel out of
    the whole thing, because you have no intent at all to really contribute to something,
    which would bring the VB-community forward.

    Olaf

  26. #26
    PowerPoster
    Join Date
    Feb 2017
    Posts
    4,996

    Re: [RESOLVED] Obtain Form Size in Millimeters

    Quote Originally Posted by Schmidt View Post
    Ok, let's make a simple test now - and see how you react:

    If you'd care to read about (and understand) the goals (I've posted them here often enough) -
    what I want to accomplish with the RIchClient in the end, you'd know that it is a lot of work
    that still remains (to finally come up with a compatible IDE and compiler and new classbased Runtime).

    If you now say:
    "Ok, I find the goals worthwhile and am willing to contribute over at least one year,
    about one hour per day on average, to help you reach that goal for the benfit of all"...

    then I will in turn:
    Immediately send you the current sources of the RichClient (since there's no reason
    not to trust you, is there? - and the sources will be helpful in your "daily contribution to the over-all project").

    BTW, a few developers here already have the sources (because they help, or were helpful in the past).

    So, is the above offer vanity on my part?
    I'd say not - and am quite sure that on the other hand, you will now weasel out of
    the whole thing, because you have no intent at all to really contribute to something,
    which would bring the VB-community forward.

    Olaf
    What is specifically the question?
    I would not share that source code with anybody since it is something sent to me in private.

    Vanity? That's your intellectual property, not vanity.

    I don't know if I want to go ahead with this subject at this time because I still didn't share much code, so I don't feel as currently being an authority on the matter.

    When I read the rant on this thread I was tempted to say my opinion, may be it was a mistake.

    I still think that picking the right choice and having an agreement on this issue is important for the future development of the language and community. It is not a minor issue and need to be discussed with much attention at some point.

    I'm currently preparing something to share and I plan to do it with the conditions that I mentioned above (close to public domain), so if you think it is the wrong way to do it stop me now (well, you still have a month or may be even more).

    After all, if we want to be a cooperative community perhaps I souldn't take steps on my own without consulting others.

  27. #27
    Fanatic Member
    Join Date
    Aug 2013
    Posts
    806

    Re: [RESOLVED] Obtain Form Size in Millimeters

    Eduardo, it doesn't really matter if you believe my motivations or not. Even if I am a megalomaniac, open-source licenses and copyright are what they are. I didn't invent them.

    All open-source licenses require attribution. Every single one, without exception. My code contributions are all released under a simplified BSD license, which is the most permissive open-source license currently available. I couldn't make my code "more free" even if I wanted to.

    You want me to ignore the attribution requirement of open-source, but without attribution, there is no way to coordinate bug-fixing and patches. Instead, all you have is a million standalone code snippets, with no attempt to coordinate efforts or move the language forward. Apparently this is what the VB community wants, which is why its open-source efforts have made zero progress over the past twenty years.

    If you have discovered a way to make open-source work without requiring attribution, please share it with the rest of us. That would be a revolutionary discovery.

    But in the meantime, remember this thread every time the "why doesn't VB6 have a successor?" question arises. VB6 doesn't have a successor because the community is obsessed with what open-source allows them to take. They care far less about what open-source asks them to give.

    Even if a person gives away their code freely, with the most permissive license imaginable, a license that allows anyone to freely use the code in any project they want, open or closed source, commercial or non-commercial, the community will still say "that's not enough. We also want you to give up any hope of getting bug reports or patches for your code."

    This attitude is what's toxic. Why would anyone continue to participate in a community like that?
    Check out PhotoDemon, a pro-grade photo editor written completely in VB6. (Full source available at GitHub.)

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

    Re: [RESOLVED] Obtain Form Size in Millimeters

    Alright, let me weigh in again, and let me start with part of a PM I just sent to another forum member who had offered me support:

    Also, yesterday, I went through and compared my code to the links Tanner provided. And, the more I look at it, the more I remember about what I did. Yes, I looked at Tanner's work. In fact, on these forums, Tanner himself gave me reference to those links when I was working something out. It wasn't like I went and found them, and used them without any discussion.

    Furthermore, after finding them, I spent probably half-a-day teaching myself all about EDIDs, and thinking through every line of Tanner's code, in many places reworking it and in others expanding it beyond what it originally did. And, it wasn't that much code to start with. Maybe think in terms of a set of core routines to read any registry entry. And that's all we're talking about ... reading some obscure stuff out of the registry and making sense of it.

    I was beginning to think I was the odd man out, but a couple of you have stepped up and said you don't think I've done anything wrong. And I did try my best to take the high-road here, offering a sincere apology, but it just didn't seem to be enough.

    And also, most of what appears in post #9 is of my own creating, and, as a whole, it's not that much code. We're not talking about me wholesale taking his PhotoDemon and sharing it in whole and not letting someone know that he wrote it. There's just got to be some reasonableness about this. That's all I'm asking people to appreciate.

    Also, Olaf, I believe if you read through the above threads (and also in a PM I immediately sent to Tanner), I vehemently apologized. I'll do it again. Tanner, I'm truly sorry that I didn't think to let it be known that you and your code assisted me toward understanding how to use the EDID. What else am I to say?

    And, I'll close with repeating this, yet again. Basically, I agree with the points Tanner was making.

    But let me take another perspective too (and maybe that I have these "other" perspectives is what's galling to Tanner, but I'm not going to just "turn off brain"). I've posted a great deal of work out here. And, when I do, I virtually never put any self-attribution in the comments. Furthermore, only once have I attached the GPLv3 license, and was severely dinged for that, so I don't do that any longer either. And, on many occasions, I've seen my code reworked and re-purposed for other uses. Typically, I get a warm-fuzzy feeling inside when I see that. Hey, someone has found my work useful.

    In some ways, it reminds me of teaching, which I've done at the university level for many years (both undergraduate and graduate level classes). It's difficult in that I convey knowledge, but I seldom get to know the fruits of that knowledge. I always got top ratings, but it was seldom that I'd get a letter years later saying how much they appreciated my class, and how it has helped them in life. I just had to "trust" that my efforts were having a positive influence. My contributions to these forums are much the same way.

    Best To ALL of You,
    Elroy
    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.

  29. #29
    Fanatic Member
    Join Date
    Aug 2013
    Posts
    806

    Re: [RESOLVED] Obtain Form Size in Millimeters

    Elroy, your statement of "in many places reworked it and in others expanded it beyond what it originally did." That's simply not true. 90% of the code is a verbatim copy of the original. I can color-code each copied line for the curious. The vast similarities are how I recognized it in the first place!

    I'm particularly frustrated with this example because it shows everything that goes wrong when sharing isolated snippets without deeper understanding or context. For one thing, you added your own bad information with statements like "Also, this won't work on older OSs. It probably needs Windows 8.1 or later." That's not true. It works all the way back to Vista. The original code states this explicitly. (It's almost like the original author of something tends to understand it pretty well. Who knew?)

    Then, you've reduced the millimeter measurement retrieval to a series of magic numbers. Tell me how a new user is supposed to understand code like this:

    Code:
    Public Function MonitorWidthMM(hMonitor As Long) As Single
        ' Returns ZERO if not found or not available for some reason.
        Dim bbEDID() As Byte
        '
        If Not MonitorEDID(hMonitor, bbEDID) Then Exit Function
        MonitorWidthMM = ((bbEDID(68) And &HF0) * 16) + bbEDID(66)
    End Function
    Where did all those magic numbers come from? How is anyone supposed to know what that does or why it works?

    In the original code, the EDID structure is carefully explained, with step-by-step explanations of how we arrive at those seemingly magical numbers. There is also additional code for pulling a bunch of other useful data out of the EDID block, like native resolution and a monitor name. Why would you claim you "expanded it beyond what it originally did"? What does your code do that the original does not?

    People seem to think I'm against free sharing of code snippets. I have no idea how you'd arrive at that conclusion given the hundreds of snippets I've posted in these forums. I'm not against that at all.

    But when you take code from an existing source - code with a clear license - strip all attribution, then change it for the worse and re-post it, how does that help anyone? Now, when someone searches "VB6 EDID" and they stumble across this thread, with a bunch of magic numbers and bad information on supported OSes, they're going to be worse off than before. A basic one-line attribution would let them compare Elroy's work to the original, and maybe discover something useful in the process.

    (And the real irony here is - who is more obsessed with getting credit for their work? The original author, or the person who made a few changes and re-posted it? Who is making a bigger deal of the work they put into this particular piece of code?)
    Check out PhotoDemon, a pro-grade photo editor written completely in VB6. (Full source available at GitHub.)

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

    Re: [RESOLVED] Obtain Form Size in Millimeters

    Ok, we truly are tilting at windmills here, and I'll take as much (if not more) of the blame for this "tilting" as anyone.

    This is a truly sad affair for me.

    Best To All, and I'm ABSOLUTELY out of this thread,
    Elroy
    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.

  31. #31
    PowerPoster
    Join Date
    Feb 2017
    Posts
    4,996

    Re: [RESOLVED] Obtain Form Size in Millimeters

    Quote Originally Posted by Tanner_H View Post
    Eduardo, it doesn't really matter if you believe my motivations or not. Even if I am a megalomaniac, open-source licenses and copyright are what they are. I didn't invent them.
    Open source licenses are what they want them to be. You have plenty of choices to choose from, and if you don't find one that fits your intention, you can make your own.
    They are not found written in stones, these are agreements that people redact.
    I concede that there are some already accepted by organizations and contemplated in some counties laws, but that doesn't prevent to you to redact a new one.

    Quote Originally Posted by Tanner_H View Post
    All open-source licenses require attribution. Every single one, without exception.
    Wrong. Olaf taked about that we need to study more the many licenses that there are there...

    Quote Originally Posted by Wikipedia
    (URL) Author attribution is required by several licenses, such as the open content Creative Commons licenses and most open-source software licenses like the MIT permissive license. Open content licenses without the requirement for author attribution are Public domain equivalent licenses, like CC0.
    Public domain equivalent license.

    Quote Originally Posted by Tanner_H View Post
    My code contributions are all released under a simplified BSD license, which is the most permissive open-source license currently available. I couldn't make my code "more free" even if I wanted to.
    Well, you can use CC0 license if you want (link to license).

    Or you can make your own, as I said.

    Quote Originally Posted by Tanner_H View Post
    You want me to ignore the attribution requirement of open-source, but without attribution, there is no way to coordinate bug-fixing and patches. Instead, all you have is a million standalone code snippets, with no attempt to coordinate efforts or move the language forward. Apparently this is what the VB community wants, which is why its open-source efforts have made zero progress over the past twenty years.
    I don't share that view, in fact I think the opposite:
    If someone wants to contribute, she/he will send you the bugs.
    If someone doesn't want to contribute, she/he won't send you the bugs reports anyway, even if you try to force them.

    About knowing who is the original author and how to contact him, I can concede that point. But still, for having a couple of bugs reports more, it doesn't worth the disavantages that I'll mention below:

    This posture limits the people that will be confortable using and sharing that code, because they can never be sure if they are doing the right thing or not. So it is better not to burden the people with such conditions.
    That's my current point of view, that's not written in stone either but is what I think.

    Quote Originally Posted by Tanner_H View Post
    If you have discovered a way to make open-source work without requiring attribution, please share it with the rest of us. That would be a revolutionary discovery.
    I already did. CC0 or W T F P L, may be there are others or you can make your own.

    Quote Originally Posted by Tanner_H View Post
    But in the meantime, remember this thread every time the "why doesn't VB6 have a successor?" question arises. VB6 doesn't have a successor because the community is obsessed with what open-source allows them to take. They care far less about what open-source asks them to give.
    My opinion is that this issue of "hey, you copied my code and you didn't mention me" have much to do with why many people are not contributting or sharing work. You are not the only one. I also read feeling like yours in the past from people that had contributed very much and decided not to do so any more.
    They blame the VB6 community because they don't do the attribution.

    Then, are we going to change the mind of all the community (because we want bugs reports, according to you)? Is that possible? Is it a realistic goal?

    Or the other option is to say: OK, I'll give a sh*t about attribution, I want this community to go ahead and develop all that is needed.
    If you are interested in fame, the people will know anyway who are the ones that made that possible.

    But if we stay in that posture, it is to keep doing the same thing, something that many contributors did in the last years (ranting because they don't get attribution), and that didn't take us to a good place.

    Something needs to change, or to change the mind of the whole VB6 community, or change the mind of the contributors.
    The latter are less in number, may be easier to convince.

    Quote Originally Posted by Tanner_H View Post
    Even if a person gives away their code freely, with the most permissive license imaginable, a license that allows anyone to freely use the code in any project they want, open or closed source, commercial or non-commercial, the community will still say "that's not enough. We also want you to give up any hope of getting bug reports or patches for your code."

    This attitude is what's toxic. Why would anyone continue to participate in a community like that?
    As I said. And if we are organized, anyone will know were to send the bugs reports. That won't be a problem.
    If someone wants to send bugs reports, he will do it, if not, you won't be able to force him even if you send the police.

    If we develop a nice ambience, may be they will also be encouraged to help more (sending bugs reports).

  32. #32
    Fanatic Member
    Join Date
    Aug 2013
    Posts
    806

    Re: [RESOLVED] Obtain Form Size in Millimeters

    Quote Originally Posted by Eduardo- View Post
    Wrong. Olaf taked about that we need to study more the many licenses that there are there...

    Public domain equivalent license.

    Well, you can use CC0 license if you want (link to license).
    I linked to the OSI page for a reason. CC0 and PDE licenses are not open-source licenses.

    The Wikipedia page you shared explains it right there on the page.

    Open-source is about more than just "freely available code".

    Quote Originally Posted by Eduardo- View Post
    Then, are we going to change the mind of all the community (because we want bugs reports, according to you)? Is that possible? Is it a realistic goal?
    No, it probably isn't realistic, which is why so many of us end up walking away from the community. It makes me sad, but I don't disagree with you.

    Quote Originally Posted by Eduardo- View Post
    Or the other option is to say: OK, I'll give a sh*t about attribution, I want this community to go ahead and develop all that is needed.
    No other community has made this attitude work. Why would VB6 be different? I think twenty years of failed open-source efforts show that this attitude doesn't lead to anything successful.

    I really mean this, genuinely: please show me a successful "free software" project that works without open-source licenses. I have searched, and I don't know of any. I think open-source systems were invented for a reason. They have given us countless incredible pieces of software.

    Can the "attribution doesn't matter" crowd say the same?
    Check out PhotoDemon, a pro-grade photo editor written completely in VB6. (Full source available at GitHub.)

  33. #33
    PowerPoster
    Join Date
    Aug 2010
    Location
    Canada
    Posts
    2,412

    Re: [RESOLVED] Obtain Form Size in Millimeters

    Guys, it's not rocket science. If the software (source or compiled) you want to use has a license, you abide by the license. If you don't like the license, you don't use the software. Any other choice (regardless of your motivations or intentions) is most likely illegal. If you live in a country where it is not illegal, then it is certainly always immoral.

    The motivations behind the license really have no bearing on anything, but I really don't understand how asking for the license & attribution to remain in any source code you use can possibly be considered onerous when you get all the effort that went into its development for free. It takes more effort to strip it than to leave it alone for crying out loud.

    Quote Originally Posted by Tanner_H View Post
    I really mean this, genuinely: please show me a successful "free software" project that works without open-source licenses.
    There is one I can think of, but admittedly it's an exception to the rule: SQLite is public domain.

  34. #34
    PowerPoster
    Join Date
    Feb 2017
    Posts
    4,996

    Re: [RESOLVED] Obtain Form Size in Millimeters

    Quote Originally Posted by Tanner_H View Post
    I linked to the OSI page for a reason. CC0 and PDE licenses are not open-source licenses.
    OK, I'll call it "free source" or "free software" so there is no confussion.
    The sources are still "open".

    Quote Originally Posted by Tanner_H View Post
    No, it probably isn't realistic, which is why so many of us end up walking away from the community. It makes me sad, but I don't disagree with you.
    Well, we have a point of agreement.

    Quote Originally Posted by Tanner_H View Post
    No other community has made this attitude work. Why would VB6 be different? I think twenty years of failed open-source efforts show that this attitude doesn't lead to anything successful.

    I really mean this, genuinely: please show me a successful "free software" project that works without open-source licenses. I have searched, and I don't know of any. I think open-source systems were invented for a reason. They have given us countless incredible pieces of software.

    Can the "attribution doesn't matter" crowd say the same?
    Why we need to be so closed minded.

    Why not to think in something new?

    VB6 community may not be as other communities. It comes from closed source, and now is forced by the circunstances to find its way.
    Trying to apply the rules that (to some point) worked for open source communities had no success so far, so let's try something else...
    That's what I'm saying.

    PS: I have to travel in a couple of hours and I'm not sure I'll be able to write here for some days.

  35. #35
    Fanatic Member
    Join Date
    Aug 2013
    Posts
    806

    Re: [RESOLVED] Obtain Form Size in Millimeters

    Quote Originally Posted by jpbro View Post
    There is one I can think of, but admittedly it's an exception to the rule: SQLite is public domain.
    That's a great example, jpbro. Thank you for sharing. It is amazing the amount of work required to release a project like that. From the same page:

    All of the deliverable code in SQLite has been written from scratch. No code has been taken from other projects or from the open internet. Every line of code can be traced back to its original author, and all of those authors have public domain dedications on file. So the SQLite code base is clean and is uncontaminated with licensed code from other projects.
    That is an incredible accomplishment.
    Check out PhotoDemon, a pro-grade photo editor written completely in VB6. (Full source available at GitHub.)

  36. #36
    Fanatic Member
    Join Date
    Aug 2013
    Posts
    806

    Re: [RESOLVED] Obtain Form Size in Millimeters

    Quote Originally Posted by Eduardo- View Post
    Why we need to be so closed minded.

    Why not to think in something new?

    VB6 community may not be as other communities. It comes from closed source, and now is forced by the circunstances to find its way.
    Trying to apply the rules that (to some point) worked for open source communities had no success so far, so let's try something else...
    That's what I'm saying.
    If that's the way the community wants to go, I wish them the very best of luck.

    For better or worse, I don't have that kind of faith. If people are too lazy to include a one-line attribution in their code, I think they will also be too lazy to contribute in meaningful ways. But maybe I'm wrong.

    (Hope you have safe and happy travels.)
    Check out PhotoDemon, a pro-grade photo editor written completely in VB6. (Full source available at GitHub.)

  37. #37
    PowerPoster
    Join Date
    Aug 2010
    Location
    Canada
    Posts
    2,412

    Re: [RESOLVED] Obtain Form Size in Millimeters

    Quote Originally Posted by Tanner_H View Post
    "ll of the deliverable code in SQLite has been written from scratch. No code has been taken from other projects or from the open internet. Every line of code can be traced back to its original author, and all of those authors have public domain dedications on file. So the SQLite code base is clean and is uncontaminated with licensed code from other projects. "

    That is an incredible accomplishment.
    It is indeed, and it shows what is necessary to properly do public domain - write every damned line yourself! No copying snippets from forums, no stripping out attributions or licenses from source available on public repositories. It's no wonder open-source is a more popular choice (and has more success stories), because being truly public domain requires a mountain of work.

  38. #38
    PowerPoster
    Join Date
    Feb 2017
    Posts
    4,996

    Re: [RESOLVED] Obtain Form Size in Millimeters

    Quote Originally Posted by jpbro View Post
    It is indeed, and it shows what is necessary to properly do public domain - write every damned line yourself! No copying snippets from forums, no stripping out attributions or licenses from source available on public repositories. It's no wonder open-source is a more popular choice (and has more success stories), because being truly public domain requires a mountain of work.
    I would like to know if my idea is right:
    To make the acknowledgements in the parts that you've taken from open source projects.

  39. #39
    PowerPoster
    Join Date
    Aug 2010
    Location
    Canada
    Posts
    2,412

    Re: [RESOLVED] Obtain Form Size in Millimeters

    Quote Originally Posted by Eduardo- View Post
    I would like to know if my idea is right:
    To make the acknowledgements in the parts that you've taken from open source projects.
    To be absolutely crystal clear - I am not a lawyer, and my understanding of open source licenses is rudimentary at best. I MAY BE 100% WRONG ABOUT THE BELOW.

    In the case of the simplified BSD that Tanner uses for PhotoDemon, my reading of the license indicates that if you are distributing the source code (even modified source code), you must leave the Copyright Notice and license in the source. If you are redistributing binaries, then you must include the Copyright notice & license PLUS the disclaimer somewhere alongside the binaries or in your documentation. You are free to modify the source anyway you see fit, redistribute it anyway you see fit, provided you comply with the above. You do NOT have to contribute anything else back to the author (unlike some viral licenses like GPL* which have requirements to make your modifications open-source under the same license AFAIK).

  40. #40
    PowerPoster
    Join Date
    Feb 2017
    Posts
    4,996

    Re: [RESOLVED] Obtain Form Size in Millimeters

    Quote Originally Posted by Tanner_H View Post
    If that's the way the community wants to go, I wish them the very best of luck.
    I'm sad to read that. We need more contributors, not to lose the very few good ones that we currently have.

    And I don't know if this is the way the community wants to go. But let's explore the options.

    Quote Originally Posted by Tanner_H View Post
    For better or worse, I don't have that kind of faith.
    That must be the difference, I do.

    Quote Originally Posted by Tanner_H View Post
    If people are too lazy to include a one-line attribution in their code, I think they will also be too lazy to contribute in meaningful ways. But maybe I'm wrong.
    Most of them yes, no doubt.
    They won't give attribution, won't contribute in development, won't report bugs, but benefit from using the new tools.

    Is that just?
    If we asked for attibution and they don't give it, it is not just.
    But if we don't require attibution then yes, it is just.
    But, is that fair?
    Not, may be not. And are we ready for doing this "unfair" thing?

    It reminds me lending money.
    At some point I came to the conclussion that it is better to give it for free and not to lend.
    Because when lending money, if the other person do not return it in the time lapse that was agreed, I start to have bad feelings with the person. And more if I know that he has money now but is not returning mine.
    So, better if I want to help someone, just give it. So I don't have any possibility of bad feelings.

    Quote Originally Posted by Tanner_H View Post
    (Hope you have safe and happy travels.)
    Thank you!

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