twinBASIC Update: February 4, 2025

Highlights include support for creating enterprise-level Windows services in twinBASIC (with working samples) and a tB IDE Add-in for copying VB6 controls to tB.

twinBASIC Update: February 4, 2025

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 Monday week, 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, please leave a comment below.

Here are some links to get involved with the project:


Highlights

Easily Create Windows Services with twinBASIC

Native Windows Service implementation arrives in twinBASIC, marking a significant milestone for enterprise development capabilities.

The new WinServicesLib package introduces a streamlined approach to creating Windows Services, eliminating the complexity traditionally associated with service development. The implementation provides a clean, object-oriented interface through the ITbService interface, which handles the core service lifecycle events. Developers can now focus on business logic rather than wrestling with Win32 API declarations and service control handler complexities.

A basic Windows Service can be created in just minutes using twinBASIC's new service framework.

Two new sample projects, 21 and 22, make it easy to get started developing Windows services.

To implement a service, developers start by configuring service properties through the Services.ConfigureNew method, setting essential attributes like:

  • Name
  • Description
  • InstallStartMode

The framework handles command-line parsing to determine whether the application should run as a service or handle installation tasks, making deployment straightforward. The service logic itself is implemented in a class that implements ITbService, with three key methods:

  1. EntryPoint: for the main service code
  2. StartupFailed: for error handling
  3. ChangeState: for processing service control requests

This advancement brings twinBASIC closer to feature parity with enterprise development platforms.

The service framework includes built-in support for installation, uninstallation, and status reporting to the Service Control Manager (SCM). Multiple services can be hosted within a single executable, with each service implementation cleanly separated through the ITbService interface. The framework also provides proper shutdown handling and status reporting, ensuring services behave correctly within the Windows service management ecosystem.

Developers can now create production-ready Windows Services without leaving the comfort of their familiar BASIC syntax.

*The above summary was generated by Claude-3.5-Sonnet-200k based on sample code from twinBASIC Sample 21. "Windows Service Simple Example."

Advanced Service Integration with IPC and Event Logging

twinBASIC's complex service example (Sample 22) showcases enterprise-level Windows Service capabilities with sophisticated inter-process communication and event logging features.

The sample demonstrates two services sharing a single executable, with TBSERVICE001 requiring password authentication and TBSERVICE002 supporting pause/continue functionality. Both services implement named pipe servers for bi-directional communication, allowing clients to request operations like time queries and MD5 calculations. The implementation includes proper Windows Event Log integration through a new message table resource system, which enables localized event logging with structured categories and event types.

This represents a significant milestone in twinBASIC's enterprise development capabilities.

The architecture employs several advanced features including PropertyBag-based message passing, async communication patterns, and service state management. The services demonstrate proper lifecycle handling with configurable dependencies, shared process hosting, and granular status reporting to the Service Control Manager. A comprehensive management UI allows for service installation, control, and real-time monitoring of named pipe communications.

These capabilities position twinBASIC as a viable platform for enterprise service development.

The sample provides practical patterns for common service scenarios including:

  • Secure service startup with password validation
  • Proper service shutdown handling
  • Named pipe-based IPC with async message handling
  • Structured event logging with localization support
  • Service pause/continue implementation
  • Multiple service coordination within a single executable

Developers can now create production-grade Windows Services with sophisticated IPC and monitoring capabilities entirely in twinBASIC.

BETA 672 introduces three brand new built-in libraries: WinEventLogLib, WinNamedPipesLib, and WinServicesLib. Sample 22 provides working code to showcase the capabilities of all three.

*The above summary was generated by Claude-3.5-Sonnet-200k based on sample code from twinBASIC Sample 22. "Windows Service Complex Example (inc. Event Logging and IPC)."

Discord Chat Summary

* Auto-generated via Claude-3.5-Sonnet-200k on poe.com

Overview

The past week saw active discussions around IDE functionality, project management features, and third-party component integration in twinBASIC. Notable focus areas included package handling during project imports, IDE window management, and considerations around 32-bit ActiveX compatibility in 64-bit applications. Community engagement remained strong with constructive technical discussions and problem-solving.

IDE Functionality & Themes

  • A bug was identified where older twinBASIC versions display incorrect themes when custom themes are set in newer versions (reported by fafalone, confirmed by Wayne Phillips)
  • The new appdata folder structure for addins/locale/themes requires built-in themes to remain in the standard folder while user-defined themes go in appdata (clarified by Wayne Phillips)
  • Multiple users reported issues with IDE window positioning when disconnecting secondary displays, suggesting potential improvements needed for window management

Package Management & Project Structure

  • A significant issue was discovered where project imports incorrectly include built-in packages in the .twinproj file, causing file size bloat (identified by fafalone)
  • Wayne Phillips confirmed this behavior needs fixing but noted the compiler correctly uses built-in package versions regardless of what's stored in the project file
  • The community suggested built-in packages should not be exported by default to prevent unnecessary duplication

Legacy Component Support

  • Detailed discussion emerged around 32-bit ActiveX compatibility in 64-bit applications, highlighting a key migration challenge
  • fafalone suggested that even when component replacement is necessary, twinBASIC still offers advantages over complete rewrites
  • The community emphasized the importance of practical migration paths for business applications with legacy dependencies

Development Tools & Integration

  • sokinkeso announced a new VB6-to-TB clipboard add-in tool for easier code migration
  • Multiple community members shared experiences with installer creation tools, with NSIS and Inno Setup being recommended options
  • Debugging capabilities were discussed, with clarification that breakpoints and stepping work but require manual breakpoint setting

Conclusion

The week's discussions highlighted twinBASIC's ongoing evolution in balancing modern development needs with legacy compatibility. While some technical challenges remain, particularly around ActiveX support and IDE functionality, the development team continues to address issues systematically. The growing ecosystem of community tools and solutions demonstrates increasing maturity of the platform.

Around the Web

New VB6 to tB Clipboard Add-in

Posted by sokinkeso in show-and-tell:

This is an experimental add-in , which converts the undocumented binary clipboard format of VB6 (when selecting controls on a form and copy them), to twinBasic clipboard format, so you can copy-paste controls from VB6 to TB, without needing to import the whole project. To run the addin:

• select any controls on a vb6 form
• copy them
• in the twinBasic IDE click the addin button
• wait for the conversion to finish
• paste on the tB form.

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.

AI-Generated Changelog Summary

* Auto-generated via Claude-3.5-Sonnet, sorted in order of its opinion of "most impactful changes."

Here's a focused summary of the notable updates in twinBASIC's latest release:

  • Enhanced Windows Integration

    • Added support for MESSAGETABLE resources and FormatMessage functionality
    • Introduced experimental Windows service-related packages (WinEventLogLib, WinNamedPipesLib, WinServicesLib)
    • Added two new samples demonstrating Windows Service implementation
  • Developer Experience Improvements

    • Added new PopulateFrom attribute for populating Enum members via JSON
    • Fixed a significant regression where form controls could become invisible after Caption changes
    • Improved intellisense TAB key behavior
  • New Programming Features

    • Added Interlocked functions support
    • Introduced new enum helper methods (GetDeclaredMinEnumValue, GetDeclaredMaxEnumValue)
    • Enhanced resource handling capabilities in the Project Explorer

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

  • IMPORTANT: This is an interim/experimental release. It includes significant changes, so some instability is to be expected. [Editor's Note: Rolling back to BETA 622 may be necessary until the BETA 623+ version stabilizes or if any of the KNOWN ISSUES below affect your project.]
  • KNOWN ISSUE: UserControls from the ACTIVE project will not appear correctly in the form designer in this release (they are purposely disabled until next release). Packaged controls, such as VBCCR will work.
  • KNOWN ISSUE: Menus currently not appearing in MDI Forms (broken in this build)
  • KNOWN ISSUE: 'Scale*' properties are often not settable in the IDE property sheet (broken in this build)
  • KNOWN ISSUE: Setting Width/Height via the property sheet often does not work correctly (broken in this build)
  • KNOWN ISSUE: Controls are not being destroyed properly by the form designer, causing big memory leaks (broken in this build)
  • there are known memory leaks in these versions, so memory usage will be higher than at the Version 1.0 release

BETA 672

  • improved: tweaked the Dark theme panel header icon filter to make the icons a little sharper [ bclothier, discord ]
  • fixed: UpDown control width was not correct at runtime [ sokinkeso, discord ]
  • added: support for MESSAGETABLE resources (for use with FormatMessage / event logging) [ VIP Gold comissioned work ]
  • added: IDE command tbFileSystem_AddResourceMessageTable and associated context menu entry in PROJECT EXPLORER [ VIP Gold comissioned work ]
  • added: support for [PopulateFrom()] attribute to allow populating Enum members via JSON, such as the MESSAGETABLE localization strings (see Sample 22) [ VIP Gold comissioned work ]
  • added: [_HiddenModule].GetDeclaredMinEnumValue(Of T) for enums, used for MESSAGETABLE handling [ VIP Gold comissioned work ]
  • added: [_HiddenModule].GetDeclaredMaxEnumValue(Of T) for enums, used for MESSAGETABLE handling [ VIP Gold comissioned work ]
  • added: some initial [_HiddenModule].Interlocked* functions (not intrinsics yet) [ VIP Gold comissioned work ]
  • added: package WinEventLogLib (experimental) [ VIP Gold comissioned work ]
  • added: package WinNamedPipesLib (experimental) [ VIP Gold comissioned work ]
  • added: package WinServicesLib (experimental) [ VIP Gold comissioned work ]
  • added: sample Sample 21. Windows Service Simple Example [ VIP Gold comissioned work ]
  • added: sample Sample 22. Windows Service Complex Example (inc Event Logging and IPC) [ VIP Gold comissioned work ]
  • fixed: intellisense TAB key behaviour [ mike webb, discord ]
  • fixed: (regression since BETA 624) changing form Caption could cause loss of WS_CLIPCHILDREN/WS_CLIPSIBLING window styles [ https://github.com/twinbasic/twinbasic/issues/1980 ]
  • updated: 1 language pack (Bahasa)
  • special thanks to our community members for the new/updated language packs (Qinghao)

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