[Mods: please feel free to move this to another forum if necessary.]
I noticed today while helping a co-worker debug a piece of VBScript that the IIf() function doesn't seem to be implemented in VBScript. Specifically, the function always returns Empty when called. Replacing the IIf(condition,true,false) with an If... Then... Else statement fixes the problem, but I'm curious about why this is so.
My theory is this: The parent application's (in this case, Outlook's) VBScript object is created as a COM object. The pointer to "IIf()" is one of many function pointers returned by the IUnknown::QueryInterface() method. However, since the VBScript object in question doesn't support IIf(), the COM object's implementation of IIf() simply returns something like E_NOTIMPLEMENTED.
Is this more or less accurate Much appreciated, Windows gurus!
Microsoft ISV Community Center Forums2