[Pharo-users] Microsoft COM

tesonep at gmail.com tesonep at gmail.com
Thu Sep 26 05:17:37 EDT 2019


Hi Tomaz,
     nice to hear you like the code you found. It is a prototype and
it is still needing some work. Basically, I needed a use case to
continue improving it.
Also, historically there was a limitation with the callbacks coming
from an external thread, but that should be fixed now with the new
Threading-ffi plugin. So, it will be possible also to expose Pharo
objects as COM objects.
Of course, we should join efforts.
Do you have any use case in mind to start working on?

Thanks,
Pablo

On Wed, Sep 25, 2019 at 10:29 PM eftomi <tomaz.turk at ef.uni-lj.si> wrote:
>
> Hi,
>
> I finally got some time to check Pablo's PharoCOM package closely. At first
> I had problems with simple things, like making Word visible with
> properyNamed:put: (it's frustrating when you see the app on the processes
> list but you cannot control it :-)) but then I found the reason - it was a
> tiny detail in Win32VariantBool>>#write:to:, and then - voila!
>
> Here's an example of opening Word for Windows, adding a blank document,
> typing some text and getting this text back to Pharo:
>
> Ole32Lib uniqueInstance initLibrary.
> wrd := COMDispatchInstance createInstanceByName: 'Word.Application'.
> wrd propertyNamed: 'Visible' put: true.
>
> docs := wrd propertyNamed: 'Documents'.
> docs dispatch: 'Add'.
>
> sel := wrd propertyNamed: 'Selection'.
> sel dispatch: 'TypeText' withArguments: {'Hello from Pharo!'}.
>
> sel dispatch: 'WholeStory' .
> Transcript show: (sel propertyNamed: 'Text'); cr.
>
> Another example is with Active Data Objects to get DB access:
>
> conn := COMDispatchInstance createInstanceByName: 'ADODB.Connection' .
> conn dispatch: 'Open' withArguments: { 'DSN=this; Uid=that; Pwd=theOther;' }
> .
> conn propertyNamed: 'State' . --> true!
> rst := (COMDispatchInstance createInstanceByName: 'ADODB.Recordset') .
> rst dispatch: 'Open' withArguments: { 'SomeTableName' . conn . 3 . 1 }.
>
> The last line raises an exception because not all of the data types that
> functions are reporting are implemented yet, as Pablo mentioned in his post.
>
> The package is really nicely prepared. The most impressive is it's
> reflective capability. My "proof of concept" work with DispHelper library
> that I mentioned in another forum topic was successful (I can get to the SQL
> Server :-)), however it's a dead-end regarding the reflection.
>
> I'm very interested in COM implementation since I found Pharo to be very
> useful as a tool, and since I work in "windowed" environment the COM
> interaction is crucial to me. I decided to spent my free evenings working on
> the project finalization. I'm not sure of how long will it take though :-)
> Pablo, I hope that I can count on your help regarding the questions about
> the overall architecture that you set.
>
> Is anybody else interested in this? Maybe we can join our efforts.
>
> Best wishes,
> Tomaz
>
>
>
> --
> Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html
>


-- 
Pablo Tesone.
tesonep at gmail.com



More information about the Pharo-users mailing list