Microsoft KB Archive/201097

= PRB: ClassView Does Not Display COM Interface Nodes =

Article ID: 201097

Article Last Modified on 12/11/2003

-

APPLIES TO


 * Microsoft Visual C++ 5.0 Enterprise Edition
 * Microsoft Visual C++ 6.0 Enterprise Edition
 * Microsoft Visual C++ 5.0 Professional Edition
 * Microsoft Visual C++ 6.0 Professional Edition
 * Microsoft Visual C++ 6.0 Standard Edition

-



This article was previously published under Q201097



SYMPTOMS
When you add COM_INTERFACE_ENTRY(IMyIF) to the COM map in a class, a corresponding interface node does not appear on the class in ClassView.



CAUSE
There is no interface declaration for IMyIF in the project's .idl file, or the .idl file has not been saved with that declaration. This is per the current design of ClassView.



RESOLUTION
Add the interface declaration to the project's .idl file and save it. In Visual C++ 6.0, the interface node will immediately appear on the class in ClassView.



STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.



MORE INFORMATION
The ClassView pane in Visual C++ displays special nodes for interfaces defined in a project's .idl file. If a Visual C++ class implements that interface, specifying it with the COM_INTERFACE_ENTRY macro between the BEGIN_COM_MAP and END_COM_MAP macros, ClassView displays a special node in the class tree as well.

In both Visual C++ 5.0 and 6.0, you must save the .idl file for ClassView to display new interface definitions. ClassView now displays nodes for the COM_INTERFACE_ENTRY macros inside class definitions, where those macros reference interfaces in the .idl file. In Visual C++ 5.0, you must also save the class definition file before ClassView can display the new interface node for the class.

Steps to Reproduce Behavior
 Download the LABRADOR sample from the Compiler COM Support samples. Open the Labrador.dsw workspace from the downloaded sample. In the workspace pane, click the ClassView tab. To display the workspace pane, right-click any blank area on the menu area, then select Workspace if it is not already selected. Expand the Labrador classes and the CLabrador branches. Double-click CLabrador. The cursor jumps to the beginning of the CLabrador class definition in Labobj.h.</li> Search for the END_COM_MAP macro. On the line before it, type COM_INTERFACE_ENTRY(IMyIF). Note there is no change in ClassView.</li> Double-click the IDog node. The cursor jumps to the IDog interface definition in Labrador.idl, right after its attributes.</li>  After the end of the IDog definition, enter the following code: [        object, uuid(62A33E87-932A-11CF-B056-00A0C90348FA), helpstring("IMyIF Interface"), pointer_default(unique) ]     interface IMyIF : IUnknown {     }; Note there is still no change in ClassView. </li> On the File menu, click Save.</li></ol>

Note that two nodes now appear for IMyIF in ClassView, one for the Labrador classes branch, and one under the CLabrador branch. With Visual C++ 5.0, you must also save the Labobj.h file to view the CLabrador node.

<div class="references_section">