Problem returning a boolean to a dll

C

chabotrobert

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top