WinWrap® Basic - VBA and VB.NET compatible scripting for Windows COM & .NET applications
header1.jpgsupport1.png
winwrap0.pngannouncements0.pngevaluate0.pnglicense0.pngorder0.pngplatforms.pngscreenshots0.pnglanguage0.pngreference0.pngsolutions0.pngsearch0.png

WinWrap® Basic for COM

Using WinWrap® Basic from a COM host application.

Getting Started

  1. Download WinWrap-COM-setup32.msi or WinWrap-COM-setup64.msi.
  2. Run the msi to install WW10_C32.OCX and WW10_32[A|W].DLL. (64 bit: WW10_C64.OCX and WW10_64.DLL.)

Where's the Script Engine?

WW10_C[32|64].OCX accesses WW10_32[A|W].DLL or WW10_64.DLL for WinWrap® Basic script editing, debugging and execution. MFC applications can access WW10_32[A|W].DLL or WW10_64.DLL directly.

What's on the WinWrap® Basic Side

ActiveX Description
BasicIdeCtl An ActiveX control that can be placed on a form. Macro editing, execution and debugging are supported through the IDE embedded in the form.
BasicNoUIObj An ActiveX object that can be referenced or created without a containing form. Macro execution is supported through the object. Macro editing and debugging are not supported.
BasicIdeObj An ActiveX object that can be referenced or created without a containing form. 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.

What's on the Application Side

COM is used to extend the WinWrap® Basic language using the IDispatch, ITypeInfo and ITypeLib interfaces.  The following class can be used with AddExtensionWithEvents:

Sample ATL/MFC Class (IDL)
[
	object,
	uuid(F282C030-CF00-11d4-8F7F-0000861EF01D),
	dual,
	// *** Event: The IAppObject interface only has the properties
	// and methods listed. It's an implementation interface so it is hidden.
	hidden,
	oleautomation,
	nonextensible,
	// ***
	helpstring("IAppObject Interface"),
	pointer_default(unique)
]
interface _IAppObject : IDispatch
{
	[propget, id(0), helpstring("property Value")]
	HRESULT Value([out, retval] BSTR *pVal);
	[propput, id(0), helpstring("property Value")]
	HRESULT Value([in] BSTR newVal);
};
[
	uuid(F282C032-CF00-11d4-8F7F-0000861EF01D),
	helpstring("_IAppObjectEvents Interface"),
	// *** Event: _IAppObjectEvents is an implementation interface so it is hidden.
	hidden
	// ***
]
dispinterface _IAppObjectEvents
{
	properties:
	methods:
	[id(1), helpstring("method ValueChanged")] void ValueChanged();
};
[
	uuid(F282C031-CF00-11d4-8F7F-0000861EF01D),
	helpstring("AppObject Class")
]
coclass AppObject
{
	[default] interface _IAppObject;
	[default, source] dispinterface _IAppObjectEvents;
};
  
Sample VB6 Class
Option Explicit

Event ValueChanged()

Private mValue As String

Property Get Value() As String
Attribute Value.VB_UserMemId = 0
    Value = mValue
End Property

Property Let Value(NewVal As String)
    mValue = NewVal
    RaiseEvent ValueChanged
End Property

What's on the User's Side

Sample WinWrap® Basic script using ATL/MFC/VB6 classes above:
Sub Main
    AppObject = "hi"
End Sub

Public Sub AppObject_ValueChanged()
    MsgBox AppObject
End Sub