Class wwDotNetBridge

This class allows accessing of .NET classes without requiring COM registration for the .NET classes. This class works by hosting the .NET runtime in Visual FoxPro and using a small proxy class to act as a Class Factory for instantiating .NET objects and passing them back for use in Visual FoxPro.

The class works through a DLL interface in wwIPStuff.dll that loads the .NET runtime, and a small .NET assembly wwDotNetBridge.dll that provides the proxy services for instantiating types and passing the back to VFP. The wwDotBridge FoxPro class is simply a front end for the .NET class.

This class supports:




Remarks

Class Members

MemberDescription
CreateInstance Creates an instance of a .NET class and passes it back to Visual FoxPro as a COM reference.
o.CreateInstance(lcClass, lvParm1, lvParm2)
GetEnumString Retrieves the string enum field name from a .NET Enum value.
o.GetEnumString(lcEnumType, lvEnumValue)
GetEnumValue Retrieves a .NET Enumerated value by passing in a string representation and retrieving the corresponding numeric value.
o.GetEnumValue(lcType, lcValue)
GetProperty Retrieves a property value from an object instance via Reflection.
o.GetProperty(loInstance, lcProperty)
GetPropertyEx Retrieves a property value from an object instance via Reflection. This method is an extended property retrieval method that allows for . syntax and array/indexer syntax in the property string value.
o.GetPropertyEx(loInstance, lcProperty)
GetStaticProperty Retrieves a static property from a .NET type.
o.GetStaticProperty(lcType, lcProperty)
GetwwDotNetBridge Factory method that can be used to create a PUBLIC instance of the wwDotNetBridge class. Use this method instead of explicitly instantiating the class to avoid recreating the .NET object wrapper object each time.
o.GetwwDotNetBridge()
InvokeMethod Invokes a method on a .NET object instance. This method can be used when the object instance cannot be directly accessed via COM such as special collections or generic types for example.
o.InvokeMethod(loInstance,lcMethod,lvParm1,..,lvParm5)
InvokeStaticMethod This method allows you to call a static .NET method such as System.Windows.Forms.MessageBox.Show() for example. Because the methods are static you can't create an instance and pass it back to FoxPro, instead this method has to be used to invoke a method.
o.InvokeStaticMethod(lcTypeName, lcMethod, lvParm1, lvParm2, lvParm3, lvParm4, lvParm5)
Load
CreateDotNetBridge
o.Load()
LoadAssembly Loads a .NET assembly into the .NET Runtime currently executing. Note that you should ensure that any required assemblies and dependent assemblies are loaded explicitly into the runtime.
o.LoadAssembly(lcAssembly)
SetProperty Sets a .NET object property via Reflection.
o.SetProperty(loInstance,lcProperty,lvValue)
SetPropertyEx Sets a value of a .NET property via Reflection. This method is an extended property setting method that allows for . syntax and array/indexer syntax in the property string value.
o.SetPropertyEx(loInstance,lcProperty,loValue)
SetStaticProperty
SetStaticProperty
o.SetStaticProperty(lcType,lcProperty,lcValue)
Unload Unloads the .NET AppDomain and any loaded assemblies within it.
o.Unload()
cErrorMsg Contains an error message if a method call fails.
lError Error flag that can be checked after certain method calls.

Requirements

Assembly: wwdotnetbridge.prg

See also:

wwDotNetBridge Examples

  Last Updated: 4/30/2008 | © West Wind Technologies, 2008