Solved

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

Posted on 1998-10-26
3
401 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

Question has a verified solution.

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

Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
In this post we will learn different types of Android Layout and some basics of an Android App.
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 tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses

635 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