デバイスコンテキスト(HDC)が対応する色ビット数は、 GetDeviceCaps()関数の第2引数にPLANESを渡す事で取得できます。
#include <stdio.h>
#include <tchar.h>
#include <iostream>
#include <windows.h>
/*
デバイスコンテキストの色ビット数を取得する
*/
int _tmain
(
int argc
, _TCHAR* argv[]
)
{
// 標準出力にユニコード出力する
setlocale( LC_ALL, "Japanese" );
// デバイスコンテキストの取得
HDC hDC = ::GetDC( NULL );
// デバイスコンテキストが対応する色数を取得する
int iBitsInAPixel = ::GetDeviceCaps( hDC, PLANES ) * GetDeviceCaps( hDC, BITSPIXEL );
// 色数を表示
std::wcout << L"デバイスコンテキストの色ビット数 = " << iBitsInAPixel << std::endl;
}
デバイスコンテキストの色ビット数 = 32