lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


That did seem to solve the problem!  Thanks to both you and Shaun for your help!

Terry

On Tue, 31 Jan 2006 19:07:52 -0300, Ignacio Burgueño wrote:
>> Well. I compiled a debug version of luacom 1.3 (as of 2005-02-28)
>> and it does not work.
>> Indeed, the code fails when calling the Add method from the
>> Word.Document class Its signature is:
>>
>> HRESULT Add(
>> [in, optional] VARIANT* Template,
>> [in, optional] VARIANT* NewTemplate,
>> [in, optional] VARIANT* DocumentType,
>> [in, optional] VARIANT* Visible,
>> [out, retval] Document** prop);
>>
>> I don't know if luacom 1.3 introduced a new approach to handle
>> optional parameters, but I think that the problem lies in the
>> function tLuaCOMTypeHandler::fillDispParams At line 943, there's
>> this code:
>>
>> else if(!byref) // here we filter the optional out params (treated
>> below) {
>> // assumes that a parameter is expected but has not been found
>>
>> var.vt = VT_ERROR;
>> var.scode = DISP_E_PARAMNOTFOUND;
>> }
>>
>> if(!byref || var.vt == VT_ERROR)
>> {
>> VariantCopy(&r_rgvarg[i], &var);
>> VariantClear(&var);
>> }
>>
>> byref is true (it was set at line 911), and the parameter is [in]
>> but it seems that that case isn't handled properly. It should pass
>> a Variant with VT_ERROR and DISP_E_PARAMNOTFOUND. I'm not quite
>> sure of how to fix this properly. Changing line 943 to this works
>> fine:
>> else if(byref) // here we filter the optional out params (treated
>> below) But I didn't check if that breaks other calls.
>>
>> Regards,
>>
>> Ignacio Burgueño
>> Desarrollo - Tecnolink S.A.
>> ignacio@tecnolink.com.uy
>>
>> Tel: +598 2 614-1003
>> www.inConcertCC.com
>>
>>
>>>> -----Original Message-----
>>>> From: lua-bounces@bazar2.conectiva.com.br
>>>> [mailto:lua-bounces@bazar2.conectiva.com.br] On Behalf Of Terry
>>>> Bayne Sent: Tuesday, January 31, 2006 2:45 PM To: Lua list
>>>> Subject: RE: LuaCOM - more questions
>>>>
>>>> Ignacio,
>>>>
>>>> Hi, thank you for taking the time to look at this.  I am using
>>>> LUACom 1.3 with Office 2003 and LUA 5.0.2.
>>>>
>>>> Terry
>>>>
>>>> On Tue, 31 Jan 2006 15:12:24 -0300, Ignacio Burgueño wrote:
>>>>
>>>>>> Hi Terry. What version of LuaCOM are you using? Just tested
>>>>>> your  sample code using luaCom 1.2 and Office 2003 and it
>>>>>> worked fine.
>>>>>>
>>>>>>
>>>>>>>> -----Original Message-----
>>>>>>>> From: lua-bounces@bazar2.conectiva.com.br
>>>>>>>> [mailto:lua-bounces@bazar2.conectiva.com.br] On Behalf Of
>>>>>>>> Terry  Bayne Sent: Tuesday, January 31, 2006 1:15 PM To:
>>>>>>>> Lua list  Subject: Re: LuaCOM - more questions
>>>>>>>>
>>>>>>>> Fabio,
>>>>>>>>
>>>>>>>> Thanks for spotting that, but still getting a type
>>>>>>>> mismatch  error:
>>>>>>>>
>>>>>>>> LUA: Calling word.Documents:Add
>>>>>>>> Error executing lua code: [COM
>>>>>>>> error:(E:\Blackdog\kibble\trunk\luacom\src\library\tLuaCOM.cpp  ,403):
>>>>>>>> Type mismatch.]
>>>>>>>>
>>>>>>>> Here is the lua code I am running:
>>>>>>>>
>>>>>>>> word = luacom.CreateObject("Word.Application")
>>>>>>>> MT = luacom.CreateObject("type.missing")
>>>>>>>> assert(word)word.visible = true
>>>>>>>> print("Calling word.Documents:Add")
>>>>>>>> doc = word.Documents:Add()
>>>>>>>> print("Back from Documents:Add()")
>>>>>>>>
>>>>>>>> Any ideas?
>>>>>>>>
>>>>>>>> Also I have tried passing MT to the Add() call like so:
>>>>>>>>
>>>>>>>> doc = word.Documents:Add(MT,MT,MT,MT)
>>>>>>>>
>>>>>>>> Thanks