Using WinWrap® Basic from a Windows Presentation Foundation host application. (WPF browser applications are not supported.)
WW10_WPF.DLL accesses WW10_32[A|W].DLL or WW10_64.DLL for WinWrap® Basic script editing, debugging and execution. When deploying WinWrap® Basic For WPF with your application, place WW10_WPF.DLL, WW10_32[A|W].DLL, WW10_64.DLL and any language resource dlls in the same folder as your application's executable.
Each version of WW10_WPF.DLL is independent. The version of WW10_WPF.DLL that you compile your application with is the one you should ship. Your project reference should use a local copy of the WW10_WPF assembly.
WinWrap® Basic For WPF has two name spaces:
| .NET | Description |
| BasicIdeCtl | A WPF control that can be placed on a window. Macro editing, execution and debugging are supported through the IDE embedded in the window. |
| BasicNoUIObj | A WPF object that can be referenced or created without a containing window. Macro execution is supported through the object. Macro editing and debugging are not supported. |
| BasicIdeObj | A WPF object that can be referenced or created without a containing window. The IDE window for this object is not created until the CreateOverlappedWindow method is called. Macro execution is supported through the object. Macro editing and debugging are supported through the IDE in the overlapped window created by CreateOverlappedWindow. |
| Handler | A handler object provides access to a single WinWrap® Basic Sub or Function. |
| Handlers | A handlers collection is a collection of Handler objects. |
| Module (untyped Object) | The module object provides access to a WinWrap® Basic module's Public Subs, Functions and Properties. |
A class used to extend the WinWrap® Basic language must implement the IDispatch interface. This is easily done. The following VB.NET/C#/C++ class can be used with AddExtensionWithEvents:
| Sample VB.NET Class |
<Microsoft.VisualBasic.ComClass(), _
System.Runtime.InteropServices.ComVisible(True)> _
Public Class AppObject
Private value_ As String
Public Event ValueChanged()
Public Property Value() As String
Get
Return value_
End Get
Set(ByVal NewValue As String)
value_ = NewValue
RaiseEvent ValueChanged()
End Set
End Property
'VB.NET doesn't support non-parametric
' default properties.
' If DispID 0 can't be found WinWrap Basic
' looks for _DefaultProperty_ instead.
Public Property _DefaultProperty_() As String
Get
Return Value
End Get
Set(ByVal NewValue As String)
Value = NewValue
End Set
End Property
End Class |
| Sample C# Class |
[ComVisible(true), InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
public interface _AppObjectEvents
{
void ValueChanged();
}
[ComVisible(true), ClassInterface(ClassInterfaceType.AutoDual),
ComSourceInterfaces(typeof(_AppObjectEvents))]
public class AppObject
{
private string value_;
internal delegate void ValueChangedEventHandler();
internal event ValueChangedEventHandler ValueChanged;
internal AppObject()
{
}
[DispId(0)]
public string Value
{
get { return value_; }
set
{
value_ = value;
ValueChanged();
}
}
} |
| Sample C++ Class |
using namespace System;
using namespace System::Runtime::InteropServices;
[ComVisible(true), InterfaceType(ComInterfaceType::InterfaceIsIDispatch)]
public interface class _AppObjectEvents
{
[DispId(1)] void ValueChanged();
};
public delegate void ValueChangedEventHandler();
[ComVisible(true), ComSourceInterfaces(_AppObjectEvents::typeid)]
public ref class AppObject
{
public:
AppObject()
{
}
~AppObject()
{
}
[DispId(0)]
property String ^ Value
{
String ^ get()
{
return value_;
}
void set(String ^ value)
{
value_ = value;
ValueChanged();
}
}
private:
String ^ value_;
event ValueChangedEventHandler ^ ValueChanged;
}; |
| Sample WinWrap® Basic script using VB.NET/C#/C++ class above |
Sub Main
AppObject = "hi"
End Sub
Public Sub AppObject_ValueChanged()
MsgBox AppObject
End Sub |