Skip to end of metadata
Go to start of metadata

The Dec-2019 Release introduces a change in how some of the samples do COM API upgrades.

In prior releases, the deep migration work in the samples was partially done by DLLs developed using our C-based API (gmNI).  gmNI is not available for typical gmStudio users, and we wanted to rework the samples using our scripting language, gmSL. In addition, prior releases of the samples used custom COM Interface Description Files (IDFs). The custom IDFs are a convenient way to map a COM API to its .NET replacement, but they have some disadvantages from a tooling and maintainability perspective. In this release, we are going to use Refactor files to specify mapping COM APIs to their .NET replacement. In some cases, the mappings also include instructions to load gmSL scripts that perform deep migration.  The gmSL scripts that are distributed as text files with the tool and the samples and they may be extended and altered by users to meet their specific upgrade needs.  Note: the COM upgrade techniques demonstrated in the samples are general capabilities that may be applied to any COM API.   Additional examples of COM upgrade rules are published on the gmStudio Extensions page. 

Deep Migration: An upgrade requiring advanced transformations such as adding or removing logic and choosing from different replacement types and coding patterns. Deep migration goes beyond the surface migrations and alterations which can be specified with refactoring attributes on various COM API elements in an IDF.

The gmNI DLLs, ScrrunMigration.dll and MscomctlMigration.dll, are no longer distributed with gmStudio. Please apply the new approach using gmSL scripts as illustrated in the latest samples. Contact Great Migrations if you require assistance.


ScanTool Sample Changes

The ScanTool sample includes several COM API replacements. One of these, Scrrun to System.IO, requires a number of deep migrations:

* Replacing FileSystemObject operations with calls to static functions
* Migrating TextStream instances and calls to one of several .NET Streams based on usage

In prior releases of the sample, the Scripting to System.IO migration was done using a custom IDF and an associated gmNI DLL: GM.scrrun.dll.xml and ScrrunMigration.dll. These migration assets were activated using the following commands in the translation script:

<Registry type="libname" source="scrrun.dll" target="GM.scrrun.dll" />
<Registry type="idfstatus" source="GM.scrrun.dll" target="migrate" />

and in the custom IDF:

<Refactor id="[GM.scrrun.dll]" dllName="ScrrunMigration.dll" event="scrrun" >

Starting with the Dec-2019 Release, we are doing the Scripting to System.IO migration with a COM Refactor IDF file and an associated gmSL script: Refactor.Scrrun.dll.xml and Transform.Scrrun.gmsl. These migration assets are activated using the following command in the translation script:

<Registry type="MigFile" source="scrrun.dll" target="Refactor.scrrun.dll" />

and in the custom Refactor IDF File:

<gmSL NameSpace="scrrun" class="Transform" Source="Transform.Scrrun.gmsl" />

This change has several advantages:

  • The Refactor IDF file contains just the rules used to map Scripting to System.IO rather than intermingling the full description of the COM API with modifications to drive the migration. We believe this change makes it easier to see and modify the mappings. The Refactor IDF file works hand in hand with the standard generated IDF file making the transition from a standard to custom translation smoother.
  • The dynamic migration is done using a gmSL script rather than a pre-compiled DLL. This makes the deep migrations open to extension and modification by gmStudio users. Note: gmSL works very precisely with low-level operations in the compiled model of the VB6/COM code. gmSL can automate very difficult transformations, but the problems and solutions are in the details.

The following files are used to direct the COM migrations for the ScanTool sample:

  • Scrrun.Refactor.xml: COM API elements adjustments for scrrun.dll to System.IO and Specialized Collections.OrderedDictionary
  • Scrrun.Transform.xml: Scrrun.Transform Class implementing transformations for various scrrun.dll API references
  • Mscomctl.Refactor.xml: COM API mapping for Windows Common Controls to WinForms Controls
  • Mscomctl.ServiceMethods.gmsl: MScomCtl.ServiceMethods class implementing service extensions that alter the processing done by the core tool at specific points in the upgrade process
  • Mscomctl.MigCode.gmsl: MScomCtl.MigCode class implementing dynamic code generation logic for MScomctl API controls
  • Mscomctl.Transform.gmsl: MScomCtl.Transform class implementing transformations for various Mscomctl API references

 Additional examples of these files and other COM upgrade rules are published on the gmStudio Extensions page. 

Other Samples

These changes also impact the FileExplorer, FMStocks, and WPFScanTool samples.