Not logged in, Join Here! or Log In Below:  
 
News Articles Search    
 

 Home / General Programming / ChoosePixelFormat Account Manager
 
Archive Notice: This thread is old and no longer active. It is here for reference purposes. This thread was created on an older version of the flipcode forums, before the site closed in 2005. Please keep that in mind as you view this thread, as many of the topics and opinions may be outdated.
 
Kevin Smith

May 22, 1999, 01:53 AM

I'm trying to get a count of the pixel formats available. Code looks like this:

HDC hdc;
PIXELFORMATDESCRIPTOR pfd;
int nCount;

hdc = GetDC(hwnd);
nCount = DescribePixelFormat(hdc, 1, sizeof(PIXELFORMATDESCRIPTOR), &pfd);

I thought that DescribePixelFormat() would return a count of the pixel formats. This call only returns 0 every time. I've checked my code against a couple of other examples I've pulled off the 'Net without much luck. Any thoughts?

 
Kevin Smith

May 22, 1999, 12:44 PM

Oops... title should say DescribePixelFormat

 
Joe

July 06, 1999, 11:51 AM

According to the docs, "If the function fails, the return value is zero. To get extended error information, call GetLastError."

What does GetLastError tell you?
(you'll wanna lookup the code in windows.h, call FormatMessage,
or use some freeware utility to interpret the value for you).

Kevin Smith wrote:
>>I'm trying to get a count of the pixel formats available. Code looks like this:
>>
>>HDC hdc;
>>PIXELFORMATDESCRIPTOR pfd;
>>int nCount;
>>
>>hdc = GetDC(hwnd);
>>nCount = DescribePixelFormat(hdc, 1, sizeof(PIXELFORMATDESCRIPTOR), &pfd);
>>
>>I thought that DescribePixelFormat() would return a count of the pixel formats. This call only returns 0 every time. I've checked my code against a couple of other examples I've pulled off the 'Net without much luck. Any thoughts?

 
Joe

July 06, 1999, 11:51 AM

According to the docs, "If the function fails, the return value is zero. To get extended error information, call GetLastError."

What does GetLastError tell you?
(you'll wanna lookup the code in windows.h, call FormatMessage,
or use some freeware utility to interpret the value for you).

Kevin Smith wrote:
>>I'm trying to get a count of the pixel formats available. Code looks like this:
>>
>>HDC hdc;
>>PIXELFORMATDESCRIPTOR pfd;
>>int nCount;
>>
>>hdc = GetDC(hwnd);
>>nCount = DescribePixelFormat(hdc, 1, sizeof(PIXELFORMATDESCRIPTOR), &pfd);
>>
>>I thought that DescribePixelFormat() would return a count of the pixel formats. This call only returns 0 every time. I've checked my code against a couple of other examples I've pulled off the 'Net without much luck. Any thoughts?

 
This thread contains 4 messages.
 
 
Hosting by Solid Eight Studios, maker of PhotoTangler Collage Maker.