tags:

views:

7

answers:

0

Hi,

I'm re-implementing part of the OLE automation code in our in-house scripting language. I've written a piece of code that reads ITypeInfo and caches its members for every interface pointer that's used in a script. I use the cached info to convert names into dispids for calls to Invoke and for parameter count checking.

We also implement a for-each style enumerator on IEnumVARIANT objects. To retrieve the IEnumVARIANT, I invoke DISPID_NEWENUM on the object on which the for-each is attempted. This code recently started to fail. I found that this failure is due to the fact that I now first check any call (whether over name or over DISPID) against my cached type info, and fail when the member cannot be found. If I skip this new check, the call executes fine.

Looking further, it turns out that the Microsoft Outlook 12.0 type library doesn't seem to define the _NewEnum member at all for the _Items interface. The interface does define Count and Item, and blindly invoking DISPID_NEWENUM on it actually succeeds, but according to the type library (I also checked using OleView) this member shouldn't exist at all.

This seems to imply that any method that isn't defined by a type library might still succeed, and that I cannot rely on the type library for these checks.

What gives?

Jaap