twinBASIC Update: August 22, 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.


Highlights

Unit Testing Sneak Preview

As I mentioned a couple of weeks ago, Visual Code now offers an integrated testing API.  That means integrated testing in twinBASIC is right around the corner.  In fact, Wayne posted a teaser this morning:

Unit testing in twinBASIC is on its way...

Partial Implementation of the VB6 App Object

For now, only the hInstance and ThreadID properties are provided.  Also, they must be called using the predeclared class object App.  For example, App.hInstance and App.ThreadID.  Full VB6-compatibility for the App object is forthcoming.

LoadResPicture Improvements

twinBASIC now supports a new enum value for the LoadResPicture function: vbResBitmapFromIcon.  It "allows ICO resources to be loaded as bitmap-based IPictureDisp objects rather than icon-based IPictureDisp objects."

Around the Web

MSVBVM60 DLL Redirections

From Wayne's original post:

Is your feature request related to a problem? Please describe.
There are some useful exported DLL functions from MSVBVM60 that VB6 developers are known to have used in their code via Declare statements. These pose a problem when switching on 64-bit support, since there is no 64-bit version of that DLL.

Describe the solution you'd like
I'd like the twinBASIC compiler to detect Declare statements into known MSVBVM60 endpoints, and redirect them to internal implementations that do the same thing.

Additional context
Let's start by making a list of the well known and most used exports from MSVBVM60 here so that we can consider them for automatic redirection by tB.

User Kr00l provided a list of commonly used functions.  These API calls are now redirected to twinBASIC internal implementations as of v0.10.4755:

  • GetMem1 (2/4/8)
  • PutMem1 (2/4/8)
  • __vbaObjSetAddref
  • __vbaObjSet
  • __vbaCopyBytes
  • __vbaCopyBytesZero

If you have functions in your VB6 code base that call into lib "msvbm60.dll, be sure to add them to the GitHub issue.

Changelog

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.10.4756, 21st August 2021]

[v0.10.4755, 20th August 2021]

[v0.10.4628, 20th August 2021]

  • fixed: LoadResPicture not always working for ICON and CURSOR types
  • added: vbResBitmapFromIcon to allow loading a bitmap based IPictureDisp from an icon resource
  • added: optional Width and Height parameters to the LoadResPicture function to allow for loading specific sized icons

[v0.10.4617, 19th August 2021]

  • fixed: Set-assignment semantics involving byref-Variants, as discussed at vbforums
  • improved: minor intellisense improvements

[v0.10.4563, 17th August 2021]

[v0.10.4503, 17th August 2021]

[v0.10.4441, 16th August 2021]

[v0.10.4386, 15th August 2021]