Microsoft KB Archive/132291

= DOC: AfxRegisterWndClass with WS_* Styles Causes Exception =

Article ID: 132291

Article Last Modified on 11/21/2006

-

APPLIES TO

 Microsoft Foundation Class Library 4.2, when used with:  Microsoft Visual C++ 1.0 Professional Edition

 Microsoft Visual C++ 1.5 Professional Edition

 Microsoft Visual C++ 1.51

 Microsoft Visual C++ 1.52 Professional Edition</li></ul>

 Microsoft Visual C++ 4.0 Standard Edition</li></ul>

 Microsoft Visual C++ 4.0 Standard Edition</li></ul>

 Microsoft Visual C++ 4.1 Subscription</li></ul>

 Microsoft Visual C++ 4.2 Professional Edition</li></ul>

 Microsoft Visual C++ 4.2 Professional Edition</li></ul>

 Microsoft Visual C++ 5.0 Standard Edition</li></ul>

 Microsoft Visual C++ 6.0 Service Pack 5</li></ul>

 Microsoft Visual C++ 4.2 Enterprise Edition</li></ul>

<ul> <li>Microsoft Visual C++ 4.2 Professional Edition</li></ul>

<ul> <li>Microsoft Visual C++ 4.2 Enterprise Edition</li></ul>

<ul> <li>Microsoft Visual C++ 4.2 Professional Edition</li></ul>

<ul> <li>Microsoft Visual C++ 5.0 Enterprise Edition</li></ul>

<ul> <li>Microsoft Visual C++ 5.0 Professional Edition</li></ul>

<ul> <li>Microsoft Visual C++ 6.0 Enterprise Edition</li></ul>

<ul> <li>Microsoft Visual C++ 6.0 Professional Edition</li></ul>

<ul> <li>Microsoft Visual C++ 6.0 Standard Edition</li></ul> </li></ul>

-

<div class="notice_section">

This article was previously published under Q132291

<div class="summary_section">

SUMMARY
The documentation for AfxRegisterWndClass states that the nClassStyle parameter can be a combination of any window style or control style.

If a window style (for example, WS_VISIBLE and WS_CHILD) is used in this parameter, then the AfxRegisterWndClass function call causes a resource exception to be thrown. Your application will probably fail, and give a message similar to this:

<pre class="fixed_text">  Unhandled Exception in myapp.exe (MFC30D.DLL): 0xE06D7363: Microsoft C++ Exception.

<div class="moreinformation_section">

MORE INFORMATION
Only Window CLASS styles (not window styles) can be used in the nClassStyle parameter. These class styles are listed in the documentation for the WNDCLASS structure. Examples of window class styles include: <pre class="fixed_text">  CS_HREDRAW CS_VREDRAW CS_DBLCLKS NOTE: This problem was fixed in Microsoft Visual C++ versions 4.0 and later.

Additional query words: AfxThrowResourceException 1.00 1.50 1.51 1.52 2.00 2.50 2.51 2.52 2.10 2.20 3.00 3.10 3.20 4.00

Keywords: kbbug kbuidesign kbvc400fix kbdocfix kbdocerr KB132291

-

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

© Microsoft Corporation. All rights reserved.