Microsoft KB Archive/139301

= FIX: C2664 Error w/Property Sheet Component Added to CDocument =

Article ID: 139301

Article Last Modified on 10/17/2003

-

APPLIES TO


 * Microsoft Visual C++ 4.0 Standard Edition
 * Microsoft Visual C++ 4.2 Professional Edition
 * Microsoft Visual C++ 4.1 Subscription

-



This article was previously published under Q139301



SYMPTOMS
When you insert a modeless property sheet from the Property Sheet component in the Component Gallery into a CDocument-derived class or other non-CWnd derived class, the compiler generates this error:

C2664:'Create' : cannot convert parameter 5 from 'class CDocDerivedClass *const' to 'class CWnd *' (new behavior; please see help).



CAUSE
The modeless property sheet component placed in an application includes a CMiniFrameWnd-derived class that actually contains the modeless property sheet. When using the component, the application calls Create on the CMiniFrameWnd-derived class. This Create requires a CWnd* to its parent window as its fifth argument. The code generated for your application passes 'this' to the Create call. CDocument is not derived from CWnd; therefore, passing the 'this' pointer from the CDocument into the CMiniFrame::Create function causes the compiler error.



RESOLUTION
Place the property sheet component into a class that is derived from CWnd.



STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. The problem was corrected in Visual C++ version 5.0.

Additional query words: kbVC400bug

Keywords: kbbug kbfix kbnoupdate kbuidesign kbvc500fix KB139301

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.