Q196830: FIX: MIDL2039 Warning with IFontDisp/IPictureDisp Parameter Type

Article: Q196830
Product(s): Microsoft C Compiler
Version(s): 2.1,3.0,5.0,6.0
Operating System(s): 
Keyword(s): kberrmsg kbActiveX kbATL210bug kbAutomation kbVC500bug kbVC600bug kbATL300bug MSGRAPH k
Last Modified: 11-FEB-2002

-------------------------------------------------------------------------------
The information in this article applies to:

- The Microsoft Active Template Library (ATL), versions 2.1, 3.0, used with:
   - Microsoft Visual C++, 32-bit Enterprise Edition, versions 5.0, 6.0 
   - Microsoft Visual C++, 32-bit Professional Edition, versions 5.0, 6.0 
   - Microsoft Visual C++, 32-bit Learning Edition, version 6.0 
-------------------------------------------------------------------------------

SYMPTOMS
========

When you compile an .idl file with IFontDisp or IPictureDisp as parameters of
methods in Visual C++ 5.0 or Visual C++ 6.0, you get a MIDL2039 warning.

CAUSE
=====

This is due to a bug in Ocidl.idl source. You must add the dual attribute to the
interface declarations for IFontDisp and IPictureDisp.

RESOLUTION
==========

To prevent the warning, add the dual attribute to the IFontDisp and IPictureDisp
interface declarations in Ocidl.idl, as in the following example:

     [
        object,
        dual,
        uuid(BEF6E003-A874-101A-8BBA-00AA00300CAB),
        pointer_default(unique)
     ]

     interface IFontDisp : IDispatch
     {
        typedef IFontDisp * LPFONTDISP;
     }

     [
        object,
        dual,
        uuid(7BF80981-BF32-101A-8BBB-00AA00300CAB),
        pointer_default(unique)
     ]

     interface IPictureDisp : IDispatch
     {
        typedef IPictureDisp * LPPICTUREDISP;
     }

STATUS
======

Microsoft has confirmed this to be a bug in the Microsoft products listed at the
beginning of this article.

This problem was corrected in Microsoft Visual C++ .NET.

MORE INFORMATION
================

Steps to Reproduce Behavior
---------------------------

1. Create a new ATL COM AppWizard Project with DLL as the Server Type.

2. Insert a new ATL Control using the ATL Object Wizard, and add the Font stock
  property by selecting it from the Stock Properties tab of the wizard.

3. Build the .idl file generated by the wizard.

You should receive the following warnings:

  warning MIDL2039 : interface does not conform to [oleautomation]
  attribute

  warning MIDL2039 : interface does not conform to [oleautomation]
  attribute

  warning MIDL2039 : interface does not conform to [oleautomation]
  attribute

Additional query words:

======================================================================
Keywords          : kberrmsg kbActiveX kbATL210bug kbAutomation kbVC500bug kbVC600bug kbATL300bug MSGRAPH kbGrpDSMFCATL kbIDL kbNoUpdate 
Technology        : kbVCsearch kbAudDeveloper kbATLsearch
Version           : :2.1,3.0,5.0,6.0
Issue type        : kbbug
Solution Type     : kbfix

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