twinBASIC Update: April 1, 2024

Highlights include dozens of bug fixes, a new MsgBox builder IDE addin, and a GitHub project for automatically setting PE image header properties.

twinBASIC Update: April 1, 2024

On April 23, 2021, I helped Wayne Phillips introduce the world to twinBASIC at the Access DevCon Vienna conference.  I boldly predicted that twinBASIC (along with the Monaco editor) would replace VBA and its outdated development environment by 2025.  With that goal in mind, this weekly update is my attempt to keep the project fresh in the minds of the VBA development community.

Every Sunday, I will be providing updates on the status of the project, linking to new articles discussing twinBASIC, and generally trying to increase engagement with the project.  If you come across items that should be included here, tweet me @NoLongerSet or email me at mike at nolongerset dot com.

Here are some links to get involved with the project:


Highlights

Bug Fix Bonanza

While there were no major new features this week, there were 11 releases that included a total of 27 bug fixes, as listed individually in the change log below.

Discord Chat Summary

* Auto-generated via Claude-2-100k on poe.com

Here is a summary of the key points from the General channel:

Intro

This transcript covers general discussion about the twinBASIC project over the past week. Conversations focused on recent bug fixes, upcoming features, and comparisons to other languages like VB6.

Summary

  • Fixed a docking bug where controls were incorrectly sized at runtime compared to design mode. This is resolved in beta 477.

  • Discussed how the docking properties apply to containers like frames and picture boxes, not just the form itself. This allows flexible UI layouts.

  • A new MsgBoxBuilder IDE addin is being tested that provides a GUI for easily generating MsgBox dialogs with custom icons, buttons, etc. Looks very slick and convenient!

  • Noted that Windows 10 is dominating the user poll, with developers less keen on Windows 11 than general population.

  • Printing visual styles correctly is tricky - PrintWindow API may work better than WM_PRINT.

  • Cut/paste does not preserve control names and indices, longstanding issue. Needs fix.

  • Passing UDTs by LongPtr only works directly, not via a struct member. Potential bug?

  • Discussed VBIDE extensibility - confirmed Rubberduck works back to Office 2000/XP/2003 but not 97 due to API differences.

Conclusion

Good progress this week on bug fixes and testing upcoming features like the MsgBoxBuilder. Docking layout is improving. Still need work in some areas like printing and cut/paste. Interesting technical discussions around VBIDE extensibility as well.


Here is a summary of the key points from the Docs channel:

Intro

This transcript covers documentation updates made to the twinBASIC wiki over the past week.

Summary

  • The Control Anchoring wiki page was updated to also cover the new docking feature for automatic control positioning and sizing.

  • The link to this updated anchoring/docking page was also added to the main wiki home page and New Features page.

  • Noted that docking makes managing form resizing much easier compared to manually adjusting coordinates.

  • A missing space in the wiki markdown was fixed.

Conclusion

The main wiki documentation was updated this week to cover the new docking feature for automatic UI layout. This will help users take advantage of docking to simplify form resizing behavior. Overall good progress on improving the project documentation.


Here is a summary of the key points from the Addins channel:

Intro

This transcript covers discussions about IDE addin features over the past week.

Summary

  • Discussed how IDE will handle hotkey conflicts between addins and built-in commands.

  • Addins need to specify a unique ID when registering hotkeys, so users can remap in IDE.

  • IDE will treat addin default hotkey as default, but allow user to reassign to avoid conflicts.

  • Host.KeyboardShortcuts.Add will be updated to require a commandID parameter for this purpose.

Conclusion

Good technical discussion on ensuring addin hotkeys remain configurable by the user to avoid conflicts. The Add method will be improved to support ID-based hotkey remapping. This will improve the addin extensibility experience.

Around the Web

MsgBox Builder Addin

twinBASIC IDE Addin guru, sokinkeso, is back with another new IDE Addin.  This one is a MsgBox Builder, which provides a user-friendly GUI for creating built-in message boxes, along with accompanying code to handle user responses.

Here's his announcement from the Discord show-and-tell channel:

This is the first release of my MsgBox Builder Addin. I upload here only the x32 version, for anyone that wants to try it, and soon both x32 and x64 will be uploaded in GitHub.

Features:
• Application or Custom title, with the option of using separate variable
• Message ,with the option of using separate variable
• Easy icon selection
• Easy Button-Group and Default Button selection
• Return value check using Select-Case or If-ElseIf statements, with the option of using separate variable.
• Copy to Clipboard button
• Preview button

SetPEImageProps Project

fafalone's latest twinBASIC project allows you to easily change certain properties of your compiled tB builds, as he describes in his announcement in the show-and-tell channel:

[A]s a temporary solution until tB offers these options itself, I've created a drop-in module you can add to any project, and it makes use of tB's [RunAfterBuild] feature to automatically modify the exe/dll/ocx/sys/cpl as soon as its built, with no further interaction required. In the future I'll add automatic signing too. It can also be called as a regular function to modify a specified file; mismatched bitness is supported (i.e. a 32bit build can modify a 64bit binary and vice versa).

The project is available on GitHub:

GitHub - fafalone/SetPEImageProps: Set PE Image Header Properties
Set PE Image Header Properties. Contribute to fafalone/SetPEImageProps development by creating an account on GitHub.

Here's an AI-generated summary of the highlights:


The SetPEImageProps project is a module created for use with twinBASIC. It allows developers to modify the compiled binaries' PE (Portable Executable) image header properties automatically after they are built. This functionality is achieved by leveraging the [RunAfterBuild] attribute in twinBASIC.

Here are some key details about the project:

  • Purpose: It was developed to investigate potential issues with default version values applied by twinBASIC and serves as a temporary solution until twinBASIC itself provides options to set these properties.

  • Properties Modified: The module can adjust several fields within the IMAGE_OPTIONAL_HEADER, including:

    • Linker version
    • Operating system version
    • Image version
    • Subsystem version
    • Win32VersionValue (which is generally not recommended to change)
    • DllCharacteristics
  • Default Values and Changes: twinBASIC sets the linker version to 6.0 (associated with Visual Studio 6.0) and the OS and subsystem versions to 4.0 (Windows NT 4.0). The module changes these to more recent values (e.g., 10.0) to disassociate them from older versions and possibly resolve compatibility issues.

  • DllCharacteristics: While the module allows modification of DllCharacteristics, it's advised to leave this alone unless necessary, as setting flags without supporting the features can lead to crashes.

  • Design: The module is designed to be easy to use and modify. It includes hard-coded values in the header but doesn't change the code itself.

  • Requirements: The module relies on the "Windows Development Library for twinBASIC" package, and it is important to use an updated version of WinDevLib to avoid corrupt executables, especially in 64-bit mode.

  • Configuration: The project contains configuration constants that can be adjusted, such as major and minor versions of the linker, operating system, image, and subsystem, as well as the Win32VersionValue and various DLLCHARACTERISTICS.

The project is available under the MIT license, which allows for liberal reuse and modification. Its main focus is on Windows development, as reflected in the topics listed on the GitHub page: windows, vb6, build-tool, pe-format, pe-file, and twinbasic.


My Ego Has Been Restored

In last week's update, I regretfully reported my embarrassing loss to RADBasic in a poll posted to the twinBASIC Discord server:

I'm happy to report I fared much better in this week's poll:

At 86%, I'm nearly as popular as Vladimir Putin!  

And this Discord poll was every bit as neutral, scientifically rigorous, and legitimate as the recent Russian presidential election:

Putin won 87.3% of the vote on a record turnout of 77.5%, the Central Election Commission (CEC) reported Monday after all the ballots from the three-day presidential vote were counted.

Changelog

Here are the updates from the past week.  You can also find this information by visiting the GitHub twinBASIC Releases page.

Releases · WaynePhillipsEA/twinbasic
Contribute to WaynePhillipsEA/twinbasic development by creating an account on GitHub.

ChatGPT Changelog Summary

* Auto-generated via ChatGPT, sorted in order of ChatGPT's opinion of "most impactful changes."

  • improved: Enhanced error handling for UserControl built-in events and IViewObject rendering to better align with VB6, improving compatibility, especially on legacy operating systems.
  • added: Introduced the missing VisualStyles property for HScrollBar and VScrollBar controls to twinBASIC.
  • fixed: Corrected various IDE issues, including problems with the kernel/native subsystem mode compilation, IDE errors when interacting with the DIAGNOSTICS panel, and the handling of the Enter and Tab keys in multiline TextBox controls.
  • fixed: Resolved issues with control arrays and event firing for Image and Label controls, ensuring correct behavior and compatibility with VBx (VB6/VBA).
  • fixed: Addressed issues with global search visibility in Light theme and font glitches in the IDE on Windows 7.
  • removed: Removed a conflicting built-in shortcut (CTRL+N) to eliminate overlap with an existing command and streamline user experience.
  • fixed: Made several regression fixes, including problems with the panel close button, floating panel restoration, and scrollbar functionality in DirListBox/FileListBox.

WARNING: The following issues are present in BETA builds 424 - 488 (the latest build as of publication):

BETA 478

  • fixed: [_HiddenModule].CreateGUID returns a string with an embedded vbNullChar terminator [ GCUser99, discord ]
  • fixed: (regression since BETA 424) kernel/native subsystem mode compilation not working [ fafalone, discord ]
  • fixed: using path seperator in Declare Lib string would cause problems for hover/intellisense popups [ fafalone, discord ]
  • fixed: double-clicking on a header in the DIAGNOSTICS panel would throw an IDE error [ fafalone, discord ]
  • fixed: Form.PopupMenu() needed a DoEvents before returning to allow for menu click events to fire before destruction [ sokinkeso, discord ]
  • fixed: trying to select text in the rename box of Project Explorer would cause drag of underlying item [ https://github.com//issues/1811 ]
  • fixed: (regression since BETA 474) panel close X button not working
  • fixed: (regression since BETA 474) floating panels not being restored
  • improved: global search contrast issues, particularly in Light theme
  • fixed: added an exception for DoEvents: which is to never treated as a line label (to match VBx) [ https://github.com//issues/1810 ]

BETA 479

  • improved: changed error handling around all UserControl builtin events to better match VB6 behaviours [ commissioned work ]

BETA 480

NOTE: This version number not listed in releases.

BETA 481

  • improved: reimplemented UserControl IViewObject rendering (used at design time in some hosts, e.g. MS Access), now offers better legacy OS support [ commissioned work ]
  • added: missing HScrollBar.VisualStyles property
  • added: missing VScrollBar.VisualStyles property
  • fixed: some minor IDE font glitches when running on Windows 7
  • fixed: tweaked the overload resolution implementation to handle some InStr edge cases [ JimAdam ]
  • fixed: DirListBox / FileListBox scrollbar not always working
  • fixed: DirListBox "Path not found" incorrect error [ sokinkeso, discord ]

BETA 482

  • fixed: (regression) clicking (add) in the property sheet for list items would not focus keyboard entry at the new element
  • fixed: having the 'Start in 64-bit Mode' IDE option ON would cause the IDE to switch to 64-bit mode regularly when you've manually changed the current session to 32-bit
  • removed: conflicting built-in shortcut CTRL+N for tbEditor_NextBookmark command as it was already assigned to command tbProject_New [ Tecman, discord ]

BETA 483

  • fixed: ENTER key behaviours in TextBox MultiLine mode to match VBx [ sokinkeso, discord ]
  • fixed: TAB key behaviours in TextBox MultiLine mode to match VBx

BETA 484

  • fixed: changed UserControl IsDirty implementation to account for changes in design time resizing [ commissioned work ]
  • fixed: changed UserControl SetObjectRects implementation for better VBx compatibility, preventing mousewheel issues [ commissioned work ]

BETA 485

  • fixed: some PictureBox.AutoSize edge cases [ commissioned work ]
  • fixed: Public/Private preceeding a block definition would often prevent auto-block-completion from occurring [ https://github.com//issues/1817 ]
  • fixed: problem with LongPtr coersions to ByRef-UDTs in some instances, causing codegen failures [ https://github.com//issues/1818 ]

BETA 486

  • fixed: (regression) Image.Click / Image.DblClick / Label.Click / Label.DblClick events not firing [ VykosX, discord ]

BETA 487

  • fixed: (regression) control arrays of Menu elements would not supply the correct Index value to events [ fafalone, discord ]
  • fixed: goto definition not working on CoClasses [ https://github.com//issues/1805 ]

BETA 488

  • fixed: constant value definitions that use enumeration values could lead to compilation errors [ https://github.com//issues/1802 ]
  • fixed: CTRL+ALT combinations not working like AltGr combinations inside the monaco editor [ Krool, discord ]

All original code samples by Mike Wolfe are licensed under CC BY 4.0