twinBASIC Update: December 26, 2021

Highlights include several improvements to the COM references list, a fix for the hidden dialog windows issue, and many discussions about possible tB features.

twinBASIC Update: December 26, 2021

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.


Improvements to the COM References List

Wayne made several improvements to the COM references list this week, including:

More detailed library information
More discoverable search feature
Library symbol / namespace shown in the detailed information

Click on the magnifying glass with the red slash through it to clear the search text with one click (available as of v0.13.56):

twinBASIC Error Info Provided to COM Callers

As of v0.13.48, your COM calling code (e.g., VBA) will return custom error numbers and descriptions that you raise in your twinBASIC DLL:

Fix for Hidden Dialog Windows

One common source of frustration for new (and experienced!) twinBASIC users is the fact that message boxes open hidden behind the VS Code window.  This is especially true since Sample 1 shows "Hello, World" inside of a message box...that never appears.

As of version 0.13.51, those dialog boxes should now appear at the top of the z-order as expected.  Since this is still considered an experimental fix, the debug console will log a message explaining what just happened:

Around the Web

Important Tip When Converting VBA to twinBASIC Libraries

VBA does not expose its code to the COM world.  This makes sense, since there is no way to compile VBA into a .dll.  Specifically, the hidden attribute VB_Creatable is set to False by default.

If you import VBA code modules into twinBASIC to create an ActiveX DLL library, you will need to manually change this attribute to True or you will get a "Class not registered" error:

Error message: "Exception has occurred. Class not registered"

For further discussion, check out this GitHub issue: Trying to use a TwinBasic ActiveX dll gives "Class not registered".

Future Support for Migrating VBA Userforms to twinBASIC

This is outside the scope of achieving 100% backward compatibility with VB6/VBA, but if there is enough interest it sounds like Wayne is open to the idea of providing a migration path for VBA Userforms to twinBASIC.

If this interests you, leave a comment/upvote on the issue at GitHub.  You can also subscribe to the issue to track implementation progress.

Future Support for a Reflection API

Check out the discussion here and subscribe to the issue to follow along.

Making Documentation Easy

This is another topic that would benefit greatly from community input at this early stage of its consideration.  What would you like to see twinBASIC support in terms of built-in (developer) documentation?  

Me, personally?  I'm a big fan of Python's Doc Tests feature.  So much so that I implemented the feature using kludgy clever hacks and workarounds in VBA.

Explicit Pointer Support in twinBASIC

I'm not sure if people were taking advantage of time off around the holiday, but there were several extended discussions around potential twinBASIC features this week: userform migrations, reflection API, documentation support.  Let's add one more to that list: Pointers.  

In this extended discussion, several of the top tB commenters went back and forth over where to draw the line in twinBASIC when it comes to supporting perhaps the lowest level feature of a modern high-level programming language: pointer manipulation.

As is standard in these sorts of extended twinBASIC language feature discussions, the opinions are strong, the discourse is civil, and the learning opportunities for low-level-curious programmers like me are bountiful.

If you've got thirty minutes to spare (or your own strong opinion on pointers), head over to the GitHub discussion page and check it out.


Here are the updates from the past week.  You can also find this information by installing the twinBASIC VS Code extension and clicking on the Changelog tab of the extension page:

[v0.13.57, 26th December 2021]

[v0.13.56, 24th December 2021]

[v0.13.55, 22nd December 2021]

[v0.13.54, 22nd December 2021]

[v0.13.53, 21st December 2021]

  • added: App.IsInIDE boolean property

[v0.13.52, 21st December 2021]

  • fixed: CustomControls (Sample 6) EXE build was failing due to the typedef change in v0.13.49

[v0.13.51, 21st December 2021]

[v0.13.50, 21st December 2021]

[v0.13.49, 20th December 2021]

[v0.13.48, 20th December 2021]

[v0.13.47, 20th December 2021]

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