PRB: VB Does Not Support Dual Interfaces in OLE Controls

Last reviewed: January 13, 1998
Article ID: Q151903
The information in this article applies to:
  • The Microsoft Foundation Classes (MFC), included with: - Microsoft Visual C++, 32-bit Edition, versions 4.0, 4.1
  • Microsoft Visual Basic Learning, Professional, and Enterprise Editions for Windows, version 4.0
  • Microsoft Visual Basic Standard, Professional, and Enterprise Editions, 32-bit only, for Windows, version 4.0

SYMPTOMS

ActiveX Controls that implement a Dual Interface do not use early binding when placed on a Visual Basic form. Even if the Dual Interface is marked as the default interface in the ActiveX Control's .odl file, Visual Basic still uses the standard IDispatch interface for all automation calls.

STATUS

This behavior is by design.

MORE INFORMATION

Dual Interface provides an alternative to using the standard IDispatch interface when making Automation calls. This technique is also referred to as Early Binding because type checking is performed at compile time. Dual Interfaces are rapidly becoming popular because they provide increased performance over the standard IDispatch interface.

It is possible to add Dual Interface support to automation servers as well as ActiveX Controls. The ACDUAL sample provided with Visual C++ 4.1 demonstrates the addition of a Dual Interface to the AutoClick automation server. Tech Note 65, referenced in the References section below, outlines the changes you must make to an automation server to support a Dual Interface. Although ACDUAL and Tech Note 65 refer to automation servers, the information they provide is also applicable to ActiveX Controls.

Visual Basic does support early binding for automation servers that support a Dual Interface, but currently does not support Dual Interface ActiveX Controls. If you attempt to use the Dual Interface on an ActiveX Control in Visual Basic, the standard IDispatch interface is used instead. Future versions of Visual Basic may take advantage of Dual Interface ActiveX Controls, but Visual Basic 4.0 does not.

REFERENCES

ACDUAL Sample - MFC OLE Samples, Visual C++ 4.1

Tech Note 65: Dual-Interface Support for OLE Automation Servers

Keywords          : CDKIss MfcOLE
Technology        : kbMfc kbole
Version           : winnt:4.0 4.1;win95:4.0,4.1
Platform          : Win95 winnt
Issue type        : kbprb


================================================================================


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: January 13, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.