Properties with Optional Parameters Not Supported (131048)



The information in this article applies to:

  • Microsoft OLE Libraries for Windows and Win32s 2.03
  • Microsoft OLE Libraries, when used with:
    • the operating system: Microsoft Windows NT 3.5
    • the operating system: Microsoft Windows 95

This article was previously published under Q131048
Properties with optional parameters are currently not supported by the IDispatch::Invoke implementation provided by the OLE system (DispInvoke and CreateStdDispatch). For example, the following results in an error from MKTYPLIB.EXE:
[propput]
void MyProperty([in] BSTR bstrValue, [in, optional] VARIANT vIndex,);
[propget]
BSTR MyProperty([in, optional] VARIANT vIndex);
		
Properties with non-optional parameters are allowed. For example, the following is acceptable:
[propput] void MyProperty([in] short nIndex, [in] BSTR bstrValue);
[propget] BSTR MyProperty([in] short nIndex);
		

Modification Type:MajorLast Reviewed:12/3/2003
Keywords:kbprogramming KB131048