Knowledge Base

DOC: AfxRegisterWndClass with WS_* Styles Causes Exception

Article ID: 132291

Article Last Modified on 11/21/2006


APPLIES TO


This article was previously published under Q132291

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:
   Unhandled Exception in myapp.exe (MFC30D.DLL): 0xE06D7363: Microsoft
      C++ Exception.
					

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:
   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