Microsoft KB Archive/151903

= PRB: VB Does Not Support Dual Interfaces in OLE Controls =

Article ID: 151903

Article Last Modified on 11/21/2006

-

APPLIES TO

 Microsoft Foundation Class Library 4.2, when used with:  Microsoft Visual C++ 4.0 Standard Edition

 Microsoft Visual C++ 4.1 Subscription

 Microsoft Visual Basic 4.0 Professional Edition

 Microsoft Visual Basic 4.0 Enterprise Edition</li></ul>

 Microsoft Visual Basic 4.0 Standard Edition</li></ul>

 Microsoft Visual Basic 4.0 Professional Edition</li></ul>

 Microsoft Visual Basic 4.0 32-Bit Enterprise Edition</li></ul> </li></ul>

-

<div class="notice_section">

This article was previously published under Q151903

<div class="symptoms_section">

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.

<div class="status_section">

STATUS
This behavior is by design.

<div class="moreinformation_section">

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.

<div class="references_section">