Previous | Index | Next 

[INFO] VB Migration Partner uses the Line, Shape, and Printer classes in Microsoft VB PowerPacks

All versions of VB Migration Partner up to 1.33 implement the Printer, Line, and Shape VB6 classes by means of custom classes defined in the support library. More precisely:

  • the Printer class is implemented by means of the VB6Printer class, which is a wrapper for a COM object exposed by VBSuportLib.dll – this DLL is written in VB6 and therefore requires the VB6 runtime
  • the CommonDialog control is implemented by means of a class named VB6CommonDialog; when the ShowPrint method is invoked, this class instantiates a COM object, also exposed by VBSupport.dll.
  • the Line and Shape controls are implemented by means of the VB6Line and VB6Shape classes. At design time, these classes appear as components in the form’s tray area, which makes it harder to move them after the migration has completed.

Starting with version 1.34, the implementation of these three classes has been moved to another support library, named CodeArchitects.VBPowerPack.dll:

  • the Printer class is implemented by means of the VB6PrinterPP class, which in turn is a wrapper for the Printer class defined in Microsoft.VisualBasic.PowerPack.Vs.dll.
  • the CommonDialog control is implemented by means of a class named VB6CommonDialogPP, which exclusively use standard .NET objects to implement all dialogs, including the Print dialog
  • the Line and Shape controls are implemented by means of the VB6LinePP, VB6ShapePP and VB6ShapeOvalPP classes, which work as wrappers for classes defined in Microsoft.VisualBasic.PowerPack.Vs.dll.

The new CodeArchitects.VBPowerPack.dll ensures that your migrated apps never depend on COM objects or the VB6 runtime to implement printing capabilities.

However, it should be noted that – unlike the classes defined in VBSupportLib.dll - the classes provided in CodeArchitects.VBPowerPack.dll might note behave exactly as in VB6. For example, the distance between lines that are printed by the VB6PrinterPP object is slightly larger than the line distance produced by the VB6Printer. Also, the VB6PrinterPP object doesn’t support a few Printer members, including DrawMode, DriverName, hDC, Port, and Zoom.

For backward compatibility, therefore, VB Migration Partner continues to convert these classes as it did with previous versions. The new features must be explicitly enabled by the developer, in one of these two ways:

  1. Use the AddLibraryPath pragma to point to the CodeArchitects.VBPowerPack.dll file, which by default is deployed in the C:\ProgramFiles\Code Architects\Code Architects VB Migration Partner\PowerPack folder. This technique allows you to decide whether to use the powerpack on a project-by-project basis
  2. Copy the CodeArchitects.VBPowerPack.dll file from the PowerPack subfolder to the main VB Migration Partner’s setup folder. In this way, all migrated projects will use the new features

Important note: the CodeArchitects.VBPowerPack DLL has a reference to the Microsoft VB PowerPack library version 9.0. This DLL can be found in the PowerPack folder and must be distributed with all migrated projects that use any of the ***PP classes.

 

Previous | Index | Next