Vb6.ActiveX.Hosting 0.1.0

dotnet add package Vb6.ActiveX.Hosting --version 0.1.0
                    
NuGet\Install-Package Vb6.ActiveX.Hosting -Version 0.1.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Vb6.ActiveX.Hosting" Version="0.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Vb6.ActiveX.Hosting" Version="0.1.0" />
                    
Directory.Packages.props
<PackageReference Include="Vb6.ActiveX.Hosting" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Vb6.ActiveX.Hosting --version 0.1.0
                    
#r "nuget: Vb6.ActiveX.Hosting, 0.1.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Vb6.ActiveX.Hosting@0.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Vb6.ActiveX.Hosting&version=0.1.0
                    
Install as a Cake Addin
#tool nuget:?package=Vb6.ActiveX.Hosting&version=0.1.0
                    
Install as a Cake Tool

Vb6.ActiveX.Hosting

Host VB6 ActiveX DLL modeless and modal forms inside a .NET process. ComHost.Open() starts a dedicated STA thread and message pump (MTA callers are fine). You do not register an OLE message filter or pump messages yourself.

Windows-only. Classic 32-bit VB6 DLLs must be loaded from an x86 (or AnyCPU prefer-32-bit) process.

Install

dotnet add package Vb6.ActiveX.Hosting

Sync

using (ComHost host = ComHost.Open())
{
  host.ModelessWindowOpened += (_, e) => { /* not on the host STA thread */ };
  dynamic launcher = host.CreateInstance("YourLib.YourClass");
  launcher.ShowNonModal();
}

CreateInstance (non-generic) returns a late-bound proxy: ShowModal / ShowNonModal run on the host STA thread, so a modal form can be closed with the title-bar close box or CloseWindows(). The host tracks each RCW and releases it on Dispose (or earlier via Release). Do not call Marshal.ReleaseComObject. CreateInstance<T> returns the raw RCW — call UI methods through Invoke / InvokeAsync.

Show vbModal blocks the caller until the form closes. From another thread, CloseWindows() or HostWindowEventArgs.Close() posts WM_CLOSE.

Async

await using (ComHost host = ComHost.Open())
{
  await host.InvokeAsync(() =>
  {
    dynamic launcher = host.CreateInstance("YourLib.YourClass");
    launcher.ShowModal();
  });
}

InvokeAsync does not block the caller. await using calls DisposeAsync.

Options

ComHostOptions options = new ComHostOptions
{
  EventContext = SynchronizationContext.Current, // WinForms/WPF UI thread
  ShutdownTimeout = TimeSpan.FromSeconds(2),
  Logger = logger,
};

using (ComHost host = ComHost.Open(options))
{
  foreach (HostWindowInfo window in host.GetWindows())
  {
    _ = window.Title;
  }
}

Activation failures throw ComHostException (ProgID/CLSID, HRESULT, regsvr32 hint). A 64-bit process throws PlatformNotSupportedException unless ThrowIf64BitProcess is false.

Requirements

  • Windows, .NET Standard 2.0 or .NET 8+ Windows
  • 32-bit process when loading 32-bit VB6 DLLs in-process
  • The ActiveX DLL registered (regsvr32 from SysWOW64) or registration-free COM

Sample app and VB6 sources: github.com/jeromydean/VB6ComHost.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net8.0-windows7.0 is compatible.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.0 90 9/19/2026