PRB: Most Common Cause of SetPixelFormat() FailureLast reviewed: September 29, 1995Article ID: Q126019 |
The information in this article applies to:
SYMPTOMSSetPixelFormat() will fail with incorrect class or window styles.
CAUSEWin32-based applications that use Microsoft's implementation of OpenGL to render onto a window must include WS_CLIPCHILDREN and WS_CLIPSIBLINGS window styles for that window.
RESOLUTIONInclude WS_CLIPCHILDREN and WS_CLIPSIBLINGS window styles when in a Win32- based application, you use Microsoft's implementation of OpenGL to render onto a window. Additionally, the window class attribute should not include the CS_PARENTDC style. The two window styles can be added to the dwStyles parameter of CreateWindow() or CreateWindowEX() call. If MFC is used, override PreCreateWindow() to add the flags. For example:
BOOL CMyView::PreCreateWindow(CREATESTRUCT& cs) { cs.style |= (WS_CLIPCHILDREN | WS_CLIPSIBLINGS); return CView::PreCreateWindow(cs); }For more information, please refer to "comments" section of the online documentation on SetPixelFormat.
STATUSThis behavior is by design.
|
Additional reference words: 3.50 4.00 95
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |