Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

SetPixelFormat GetPixelFormat

0 views
Skip to first unread message

Kevin Copps

unread,
May 12, 1998, 3:00:00 AM5/12/98
to

I have a handle to a child window whose WNDCLASS was registered and then
created with CreateWindow() in someone elses library.

I would like to make the following Win32 API calls after creation of this
window.

hDC = GetDC(hwnd);

// ... setup the pointer to a PIXELFORMATDESCRIPTOR ppfd here

int ipixelFormat = ChoosePixelFormat(hDC, ppfd);
BOOL isSet = SetPixelFormat(hDC, ipixelFormat, NULL);
int jpixelFormat = GetPixelFormat(hDC);
int ierr = GetLastError();

What I get is that isSet is TRUE but jpixelFormat is zero, which means the
call to SetPixelFormat went OK, but GetPixelFormat failed. The value of ierr
is 2000, which corresponds to ERROR_INVALID_PIXEL_FORMAT "The pixel format
is invalid".

Anybody got any idea? (please send any replies also to k...@isc.tamu.edu)

From Spy++ for this hwnd I see the following: (according to documentation
for SetPixelFormat these should be OK)

Window Styles: 56000000
WS_CHILD
WS_VISIBLE
WS_CLIPSIBLINGS
WS_CLIPCHILDREN
WS_OVERLAPPED

Extended Styles: 00000000
WS_EX_LEFT
WS_EX_LTRREADING
WS_EX_RIGHTSCROLLBAR

Class Styles: 00000008
CS_DBLCLKS


0 new messages