twinBASIC Update: December 4, 2022

Highlights include initial support for importing VB6 forms with ActiveX controls, GoSub syntax support, and context-sensitive custom help support.

twinBASIC Update: December 4, 2022

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

Context-Sensitive Help Support Added

The BETA 190 release added support for the following properties:

  • HelpContextID / WhatsThisHelpID / ShowWhatsThis for all controls
  • Form.WhatsThisButton support
  • Form.WhatsThisHelp support
  • Form.WhatsThisMode support
  • Project setting of Application HelpFile and associated VBP import support
  • App.HelpFile property support

GoSub Support Added

To be clear, no one should be writing GoSub code in 2022.  

You can rewrite any code that uses a GoSub by refactoring the GoSub code block into a standalone function.  This makes code that is easier to read, easier to test, and easier to follow logically.

That said, support for the GoSub statement is required to provide 100% VBx compatibility.  For some older code bases, the previous lack of GoSub support was one of the last major issues that prevented the successful import of VB6 projects into twinBASIC.

Screen.MouseIcon Support

As of BETA 193, you can set the mouse icon to a custom image using Screen.MouseIcon.  

For example:

Screen.MousePointer = vbCustom
Screen.MouseIcon = LoadPicture("C:\Program Files\TortoiseHg\icons\thg_logo.ico")

Around the Web

RunAsTrustedInstaller - Open Source twinBASIC Project

fafalone has released yet another open source project written in twinBASIC.  RunAsTrustedInstaller is a twinBASIC port of a utility he originally wrote in VB6.  

The utility allows you to run applications in the context of the Windows "super admin" account, TrustedInstaller.  This allows you to do potentially dangerous things–like deleting files in C:\Windows\–that Microsoft really doesn't want people doing accidentally.

Be aware, this is not a way to circumvent UAC protection.  It simply provides existing administrators complete control of their computers.  fafalone makes this distinction clear:

Important: You must use Run As Administrator to use this code; it simply allows an admin to be an actual admin, it cannot escalate a unprivileged normal user to administrator.

The utility is an open-source alternative to AdvancedRun from NirSoft.  

Here is some more background and usage ideas from fafalone:

Yeah I couldn't believe there wasn't an open source equivalent... some that opened as SYSTEM but not TI... a few specialized tools specifically for unloading Windows Defender... not to mention there's very very little in the way of VBx code that deals with tokens

FYI it can also be used without the GUI; you can open a program with it and it just launches it and exits; e.g. "C:\temp\RunAsTI64.exe" "C:\Program Files\Process Hacker 2\ProcessHacker.exe"So you can create shortcuts and whatnot

Server Upgrade Fundraising Goal Reached

In last week's update, I linked to the twinBASIC Ko-fi page where Wayne was looking for non-subscribers to donate towards a server upgrade to speed up the development process.  The community responded in a big way, meeting the fundraising goal in one week.  

Here's Wayne's response:

A massive thank you to all of our supporters helping us achieve the server upgrade goal so quickly!   I'm amazed and very grateful for all of your generosity. Time to buy the components now...

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.

BETA 190

  • added: all controls now support HelpContextID / WhatsThisHelpID / ShowWhatsThis
  • added: Form.WhatsThisButton support
  • added: Form.WhatsThisHelp support
  • added: Form.WhatsThisMode support
  • added: project setting of Application HelpFile, and associated VBP import support
  • added: App.HelpFile property support

BETA 191

  • fixed: WhatsThisHelpID not working with Label and Image controls on the root Form container [ https://github.com//issues/1188#issuecomment-1329456114 ]
  • improved: when opening a CONSOLE project now, the IDE now also shows a console window for debugging purposes [ wqweto, discord]
  • improved: Standard EXE (Console App) template now includes a basic Console class, and small demo

BETA 192

  • added: initial support for importing VBP forms that contain ActiveX controls
  • fixed: some ActiveXExtender regressions
  • fixed: tweaked Console App demo to workaround a WriteConsoleW API bug in Win 7
  • improved: redesigned the internal compiler memory management (Win32)

BETA 193

  • fixed: (regression) STATSTG UDT used in UserControl implementation was using an incompatible version of GUID type, causing compilation errors [ https://github.com//issues/1386 ]
  • fixed: (regression) UserControl.Width and Height properties have been on holiday for a while [ https://github.com//issues/1386 ]
  • added: support for Screen.MouseIcon [ sokinkeso, discord ]
  • fixed: (regression) End statement not working correctly since Forms modal support was added [ https://github.com//issues/1384 ]

BETA 194

  • added: support for GoSub
  • fixed: some imported ActiveX control events not binding due to ByVal/ByRef mismatch that is allowed in VBx [ https://github.com//issues/1389 ]
  • fixed: removed erroneous warning of "WARNING: USE OF INVALID DLLs IN KERNEL MODE..." for calls to declares in .SYS files [ fafalone, discord ]

BETA 195

  • fixed: form designer race condition could cause rendering problems during Undo/Redo [ https://github.com//issues/1365 ]
  • improved: much faster form designer grid dot rendering [ https://github.com//issues/1365 ]

BETA 196

  • fixed: tB now translates OLE pixel/himetric arguments in UserControl events into twips, as per VB6 [ https://github.com//issues/1389 ]

BETA 197

  • fixed: when using Sub Main startup object, non-modal forms were not keeping the process alive [ fafalone, discord ]

BETA 198

  • fixed: improved COM class initialization to more accurately match VBx behaviours [ https://github.com//issues/1397 ]
  • fixed: ListBox ItemCheck event now passes an Integer argument to match VBx [ https://github.com//issues/1389#issuecomment-1336260912 ]

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