Problem returning a boolean to a dll

Here is part of the code, manipulating an application (LaserFiche) API
through OLE/COM:

lf_app = WIN32OLE.new(‘LFDLL.Application’)
lf_server = lf_app.GetServerByName(‘xxxxx’)

lf_db = lf_server.GetDatabaseByName(‘xxxxx’)

lf_conn = WIN32OLE.new(‘LFDLL.Connection’)
lf_conn.UserName = ‘xxxxx’
lf_conn.Password = ‘xxxxx’
lf_conn.Create(lf_db)

lf_doc = WIN32OLE.new(‘LFSDLL.Document’)
lf_folder = lf_db.GetEntryByPath("\Informatique\afficheur")
lf_vol = lf_db.GetVolumeByName(“SAC”)

lf_doc.Create(“FromRuby”, lf_folder, lf_vol, true)

The create function succeed on first try but on the 2nd (or any
subsequent) tries it fails. The fourth parameter (‘true’) specifies if
the document is “AutoRenamed” or not… It works on the first try
because it does not already exist but on any subsequent tries it
returns “Cannot create object with same name blah blah blah…”.
If i could return a VARIANT boolean as specified in the COM browser, it
would rename the file (1), (2) etc…

As boolean values I tried true, 1, -1, 1==1 … without result. My
guess is that what is a “boolean” within ruby is not accepted as
boolean in the DLL.
Note that this script and several others are working in Perl :

$lf_doc->Create(“NameOfDocument”, FolderObject, VolumeObject, 1)

when i use the integer 1. And evidently it works also quite well with
VB and VBScript using native Windows Variant types.

Any thoughts ?

Note : This current Perl library of scripts works well but i would like
to benefit from a true OO to simplify some maintenance. I would prefer
not to go Java.

rc

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs