Solved

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

Posted on 1998-10-26
3
387 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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

758 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

21 Experts available now in Live!

Get 1:1 Help Now