Solved

how to know 555 or 565 (16bit color grafix mode) in DC ?

Posted on 1998-10-26
3
389 Views
Last Modified: 2013-11-20
Hi ..
was just wondering how to know when i declare my variable :
CClientDC dc(this)
if i am in 555 or 565 mode ? (i assume my screen depth is in 16 bits , but what kind of 16 bits ??! 16 or 15..) that's the question ... !
0
Comment
Question by:SkizoWalker
  • 2
3 Comments
 
LVL 8

Expert Comment

by:Answers2000
ID: 1323848
Try GetDeviceCaps to get current screen display info, this takes an HDC which is a member of CDC.  Your question is less than totally clear to me, perhaps you want to explain what you are trying to do, or are concerned about....
0
 
LVL 11

Accepted Solution

by:
mikeblas earned 100 total points
ID: 1323849
I don't have a 5-5-5 driver to test this with, but I believe this code works.

void CAboutDlg::OnOK()
{
      CClientDC dc(this);

      struct dib
      {
            BITMAPINFOHEADER bi;
        DWORD            ct[256];      
      };

      struct dib myDIB;

      CBitmap myBitmap;
      myBitmap.CreateCompatibleBitmap(&dc, 1, 1);

      ZeroMemory(&myDIB, sizeof(BITMAPINFOHEADER));
      myDIB.bi.biSize = sizeof(BITMAPINFOHEADER);  
      myDIB.bi.biBitCount = 0;

      // first call will fill in the optimal biBitCount
    GetDIBits(dc, myBitmap, 0, 1, NULL, (BITMAPINFO*) &myDIB, DIB_RGB_COLORS);

    // second call will get the optimal color table, or the optimal bitfields
      GetDIBits(dc, myBitmap, 0, 1, NULL, (BITMAPINFO*) &myDIB, DIB_RGB_COLORS);

      if (myDIB.ct[0] == 0xF800 &&
            myDIB.ct[1] == 0x07E0 &&
        myDIB.ct[2] == 0x001F )
      {
            MessageBox("565!");
      }

    if (myDIB.ct[0] == 0x7C00 &&
            myDIB.ct[1] == 0x03E0 &&
        myDIB.ct[2] == 0x001F )
      {
        MessageBox("555!");
      }
}

Note that there's lots of other tests you can do; I'm just testing for 5-5-5 or 5-6-5, above.

B ekiM
0
 
LVL 11

Expert Comment

by:mikeblas
ID: 1323850
Sorry about the crappy EE formatting; I forgot that tab characters don't work.

B ekiM
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
List out all word 7 255
Doc'in system (example?) BA 7 86
zeroMAx challenge 20 86
Excel file not created as expected 7 46
In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Delivering innovative fully-managed cloud services for mission-critical applications requires expertise in multiple areas plus vision and commitment. Meet a few of the people behind the quality services of Concerto.

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now