Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 1998-10-26
3
Medium Priority
?
403 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 400 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 Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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…
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.
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

963 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