Visual Basic 4 Client to 
VisualWorks Server 
through COM/DCOM
The Smalltalk Commander Example.

This sample was written in Visual Basic 4 and uses COM/Automation to create and use an Automation object implemented in VisualWorks called the Smalltalk Commander. This VisualWorks Automation object implements a Smalltalk expression evaluator using the Compiler class.

A Smalltalk Commander object is created with the standard Visual Basic function CreateObject and used like any Automation objects. The object is created as follows:

Dim StCommander As Object
Let StCommander = 	CreateObject(“VisualWorks.SmalltalkCommander”)

Since the Smalltalk Commander is published as a dual interface object, you can take advantage of Visual Basic’s and other languages ability to use Vtable bindings which is much faster than the IDispatch interface. To use the Smalltalk Commander’s Vtable bindings, you must include the type library ‘VisualWorks Smalltalk Commander’ in your Visual Basic project (Tools/References… menu) and declare your variable as follows:

Dim StCommander As ISmalltalkCommanderDisp

Using a dual interface is much faster than using the standard Automation IDispatch through a Visual Basic Object variable.
Method Reference
The Smalltalk Commander has following method:
Evaluate (Expression As BSTR) As Variant
This function evaluates the expression in the String argument Expression and answers a Variant object.
EvaluateAsString (Expression As BSTR) As String
This function evaluates the expression in the String argument Expression and answers a String object. This should be used when you know the answer cannot fit in an Automation data type. For example, the expression: 

100 factorial.

Answers the number in a String:

93326215443944152681699238856266700490715968264381
62146859296389521759999322991560894146397615651828
62536979208272237582511852109168640000000000000000
00000000
Quit
Quits the Smalltalk OLE Server.

Copyright © 1997-1999 Cincom Systems, Inc.. (BB last revision 11/23/99)