Search code examples
comactivexlotus-noteslotus-dominolotusscript

Calling COM component method from IBM Notes 9 fails


When calling a 32 bit COM component method registered in sysWOW64 fails with an error message:

"type mismatch in method OleVarToLsVal, Unknown found, Unknown expected"

Its win7 64 bit, but the Notes client is installed by default as a 32 bit application. The code looks like:

dim c as Variant
dim n as Variant

set c = createobject("MSWC.counters")
n = c.Get("xx")

When debugging the call, the object is set and testable with "isObject(c)", (although you can't inspect each method/property in detail in LotusScript debug).

The method is supposed to return a primitive long. I've tried setting n as long, clng-ing the values, cstr-ing the values, the parameter, strconv the parameter, using a variable for the parameter, all to no avail.

The exact same code run by WScript VBS host (in syswow64) runs the code as expected.

So, does anybody know:

  1. If Notes 9 COM value marshalling is working for any components?
  2. Is Notes 9 COM set to recognize the 'wow64' alternate 32 bit registry
  3. Are there some COM related marshalling settings somewhere in the registry I can check (if so what/where are they)?
  4. Is there some setting to tell Notes to use 32 bit components (like IIS 32bit compatibility option)
  5. Is there anything I need to do or could do in the main OS to 'redirect or configure' COM
  6. Or is Notes just broken again and nobody cares?

Any help appreciated - Thanks.


Solution

  • Well, 7 years on (and seriously obsolete!) just an update for anybody looking for an answer... There are a couple of Notes settings needed and not all COM/Active-X componenets or data types are supported by LotusScript, so even if Notes is setup correctly, you still may not be able to acces/use any specific component or some methods in the component.

    The user must be allowed to run unrestricted agents/code in the 'Sign or run unrestricted methods and operations:' in the security section of the server(s) document.

    The Notes client execution control list ('ECL') must allow access to 'External programs' either by default or to the code-signer. An ECL warning box will ask the user to continue if the external access has not been granted.

    If you try to execute an unsupported method or unsupported data type, then further errors will be issued either by LotusScript or COM/Active-X error reporting. The Notes developer help file for 'CreateObject' gives a bit more detail about unsupported data types:

    LotusScript does not support identifying arguments for OLE methods or properties by name rather than by the order in which they appear, nor does LotusScript support using an OLE name by itself (without an explicit property) to identify a default property. Results are unspecified for arguments to OLE methods and properties of type boolean, byte, and date that are passed by reference. LotusScript does not support these data types.

    Relying on the 'default property' to access a default method is a common mistake and requires you to pay extra attention to the component details. It is easy to assume the component is not working, but in fact you're just not using it properly.

    One way to test this is to try to open a common object available on all Windows machines (maybe others?) maybe 'FileSystemObject' (FSO) or VbScript 'regExp' component. If these work, you can build on that. Getting the 32/64bit registration correct for your client install is another element to test/get right.

    For my issues, I suspect that I was using unsupported methods or data types and having used COM/Active-X in Notes occasionally, its all worked ok in general.