COM connectivity

Simon Kirk simon at pinesoft.co.uk
Sun Dec 30 10:20:00 UTC 2007


Hi Kemal.


kemal asad-syed wrote:
> 
> can squeak connect to a COM object on windows platform ?
> and handle the callback if any from the COM ?
> if so please let me know which version an image that work well
> 

The easiest and most flexible way I've found for talking to COM from Squeak
is to use the DotNet Bridge written by John Pierce and Ben Schroeder
(http://www.saltypickle.com/SqueakDotNet).

You'll need to know how to wrap ActiveX COM objects via the .NET Interop
layer, but once you've done that you can talk to your COM objects very
easily. See http://wiki.squeak.org/squeak/459 for more details.

Two caveats: 

1. The bridge in its available state can't access VB6 Property Get/Let/Sets
properly. However we think we found the fix for this before Christmas, so
there may be a version that can access these properly soon, although see 2
below.

2. More a problem with the .NET Interop way of handling VB6 Collections, but
if any of your COM objects return a VBA.Collection, the objects stored
within the Collection are "anonymous". The collection works fine, but what I
mean is that if you retrieve an object from the Collection its type is
"System.__ComObject" - it doesn't know about any particular interface. We
have a version of the bridge that will just "have a go" at calling your
desired function/sub/property/whatever on an instance of one of these, any
if the member exists it'll work just fine, but that's about as good as we
can get it. There's no way we've found to cast the System.__ComObject to the
right type, even if we *know* its type.

Hope that helps.
Simon

-- 
View this message in context: http://www.nabble.com/COM-connectivity-tp14544943p14545750.html
Sent from the Squeak - Dev mailing list archive at Nabble.com.




More information about the Squeak-dev mailing list