Solved

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

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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Excel Use VBA to get user's Mac Address for their computer 5 172
centeredAverage challenge 8 166
Path of Workbook 3 78
"Black Box" Testing of Control System Software 2 51
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.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

809 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