Early binding of one of the interfaces is easiest to program with, as Visual Studio and the compiler assist in choosing methods and properties, and make it impossible to mistype a method or property name.
To use early binding, open the Visual Basic project in VB6, and from the Project menu select the reference menu item, or follow the steps in the VB6 documentation, to open the References dialog for the project, then make a reference to either the CEWindowAPI or CEWindowsAPIJavaStyle objects.
Examine all variables declared as “as object”. These are candidates to be converted to explicit types in the Component Enabler interface.
For all such variables in the infrastructure files (particularly the EAEEnvironment, EAEIspec and EAEListManger class files) change the 'object' to the appropriate CEWindowsAPI (or CEWindowsAPIJavaStyle) type.
For example:
Change
Option Explicit Private mobjLinc As Object Private mobjLog As Object Private mobjConsole As Object
To
Option Explicit Private mobjLinc As CEWindowsAPI.LINCEnvironmentDotNET Private mobjLog As CEWindowsAPI.Log PrivatemobjConsole As CEWindowsAPI.ConsoleModel1
Once the object declarations have been changed, search for all usages of a particular variable, and examine and change the method call.
If you simply try to compile the project, the compiler points out any problems that you need to attend to.
If you are converting to the CEWindowsAPI, you need to make a number of changes.
Most are obvious, especially when using IntelliSense. Refer to Old Call to New Call Reference for a cross reference of the old method names against the new methods names if it is not.
Most changes are in capitalizing the first character of a method call, or for some methods starting with get or set, changing them to access a property rather than a method.
If you are converting to the CEWindowsAPIJavaStyle, there are only a few changes required.
One change that you must make is in the way that the Log object is created.
Originally, the Log object had own registration and Program ID. This did not work well with the JVM, so a new getLogObject() method was introduced to the LINCEnvironment class. You should make sure that you use the new way of accessing the Log object, as the old way doesnotwork any more. The new way works with all Component Enabler runtime environment and/or JVM combinations.
For example,
Set mobjLog = mobjLinc.GetLogObject()
after you have created the LINCEnvironment object.
The last change is to choose the Component Enabler Runtime environment that you want to use. This determines which ProgramID you specify in the constructor.
If you want to use the .NET Framework runtime environment, then your constructor line is:
For CEWindowsAPI:
SetmobjLinc = CreateObject("LINCEnvironment.dotNET.1")
or
SetmobjLinc = New CEWindowsAPI.LINCEnvironmentDotNET
For CEWindowsAPIJavaStyle:
Set mobjLinc = CreateObject("LINCEnvironment.JavaStyledotNET.1")
or
Set mobjLinc = New CEWindowsAPIJavaStyle.LINCEnvironmentDotNET
If you want to use the Java runtime environment, then you need to further decide which installed JVM you want to use.
For the JRE:
For CEWindowsAPI:
Set mobjLinc = CreateObject("LINCEnvironment.JavaSUN.1") or
Set mobjLinc = New CEWindowsAPI.LINCEnvironmentJavaSUN
For CEWindowsAPIJavaStyle:
Set mobjLinc = CreateObject("LINCEnvironment.JavaStyleJavaSUN.1")
or
Set mobjLinc = New CEWindowsAPIJavaStyle.LINCEnvironmentJavaSUN
For the Jintegra JVM, use:
For CEWindowsAPI:
Set mobjLinc = CreateObject("LINCEnvironment.JavaJIntegra.1")
or
Set mobjLinc = New CEWindowsAPI.LINCEnvironmentJavaJIntegra
For CEWindowsAPIJavaStyle:
Set mobjLinc = CreateObject("LINCEnvironment.JavaStyleJavaJIntegra.1")
or
Set mobjLinc = New CEWindowsAPIJavaStyle.LINCEnvironmentJavaJIntegra
VB6 with early binding requires that you replace methods that pass objects back to the LINCEnvironment object, with special methods.
This is required as passing objects from VB6 is incompatible with the way they are passed from, say, VBScript.
Refer to Object Pooling method calls for a reference of the method calls that need substitution.